diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-05-23 18:06:01 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-05-23 18:06:01 +0200 |
| commit | 88363bcefc9b6093fab924e734c7918a76617ae5 (patch) | |
| tree | 2d354bdbeebb9d7cc03e5872024c0a32714b413f /feel.py | |
| download | tempfeel-88363bcefc9b6093fab924e734c7918a76617ae5.tar.gz tempfeel-88363bcefc9b6093fab924e734c7918a76617ae5.zip | |
Diffstat (limited to 'feel.py')
| -rwxr-xr-x | feel.py | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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') |
