Advertisement
Guest User

Ada_code

a guest
Sep 23rd, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. import time
  5. import Adafruit_DHT
  6.  
  7.  
  8. DHT_TYPE = Adafruit_DHT.DHT11
  9.  
  10. DHT_PIN = 4 #value of GPIO_PIN
  11.  
  12.  
  13. while True:
  14. humidity, temperature = Adafruit_DHT.read_retry(DHT_TYPE, DHT_PIN)
  15.  
  16. if humidity is None or temperature is None:
  17. time.sleep(2)
  18. continue
  19.  
  20. print 'Temperature: {0:0.1f} C'.format(temperature)
  21. print 'Humidity: {0:0.1f} %'.format(humidity)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement