Skip to content

Instantly share code, notes, and snippets.

@elktros
Created February 21, 2018 09:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elktros/f9f1c9e8475956d43eba95e8681676c7 to your computer and use it in GitHub Desktop.
Save elktros/f9f1c9e8475956d43eba95e8681676c7 to your computer and use it in GitHub Desktop.
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