Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import RPi.GPIO as GPIO
  2. import dht11
  3. import time
  4.  
  5.  
  6. import medioex
  7. medioex.do_di_init()
  8. a = medioex.di_read(4)
  9. print (a)
  10.  
  11. # initialize GPIO
  12. GPIO.setwarnings(False)
  13. GPIO.setmode(GPIO.BCM)
  14. GPIO.cleanup()
  15.  
  16. # read data using pin 14
  17. instance = dht11.DHT11(pin = 26)
  18. result = instance.read()
  19.  
  20. if result.is_valid():
  21. print("Temperature: %-3.1f C" % result.temperature)
  22. print("Humidity: %-3.1f %%" % result.humidity)
  23. time.sleep(10)
  24. else:
  25. print("Error: %d" % result.error_code)
  26. time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement