# Raspberry Pi Tips & Tricks - https://raspberrytips.nl import Adafruit_DHT humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, 4) humidity = round(humidity, 2) temperature = round(temperature, 2) if humidity is not None and temperature is not None: print 'Temperatuur: {0:0.1f}*C'.format(temperature) print 'Luchtvochtigheid: {0:0.1f}%'.format(humidity) else: print 'Geen data ontvangen'
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter