daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Adafruit_DHT
  2. from time import sleep
  3.  
  4. DELAY_INTERVAL = 0.3
  5. dht_sensor = Adafruit_DHT.DHT22
  6. DHT_PIN = 4
  7.  
  8.  
  9. while True:
  10.   humidity, temperature = Adafruit_DHT.read_retry(dht_sensor, DHT_PIN)
  11.  
  12.   print "Humidity: {:0.1f}%, Temperature: {:0.2f}*C".format(humidity, temperature)
  13.  
  14.   sleep(DELAY_INTERVAL)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top