123456789101112131415161718192021 |
- import time
- import Adafruit_DHT
- now = time.strftime("%Y.%m.%d %H:%M:%S")
- sensor = 11
- pin = 25
- interval = 5
- print "Datum Zeit \t Temperatur[*C] Luftfeuchte[%]"
- while True:
- start_loop_time = time.time()
- hum, temp = Adafruit_DHT.read_retry(sensor, pin)
- if hum is not None and temp is not None:
- print("%s\t %s\t %s" % (now, temp, hum))
- else:
- print "Fehler beim Auslesen des Sensors"
- time.sleep(interval - time.time() + start_loop_time)
|