summaryrefslogtreecommitdiff
path: root/feel.py
diff options
context:
space:
mode:
Diffstat (limited to 'feel.py')
-rwxr-xr-xfeel.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/feel.py b/feel.py
new file mode 100755
index 0000000..cdaa31a
--- /dev/null
+++ b/feel.py
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+import time
+import Adafruit_DHT
+
+while True:
+ sensor = Adafruit_DHT.DHT22
+ pin = 4
+ humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
+ if humidity is not None and temperature is not None:
+ data = [str(int(round(time.time() * 1000))), str(humidity), str(temperature)]
+ with open('/var/www/data.csv', 'a') as f:
+ f.write(','.join(data) + '\r\n')