Skip to content

Instantly share code, notes, and snippets.

@elktros
Created February 21, 2018 09:13
Python Script for Interfacing DHT11 Humidity and Temperature Sensor with Raspberry Pi.
import sys
import Adafruit_DHT
import time
while True:
humidity, temperature = Adafruit_DHT.read_retry(11, 4)
print 'Temp: {0:0.1f} C Humidity: {1:0.1f} %'.format(temperature, humidity)
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment