Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from machine import Pin
- from time import sleep
- import dht
- sensor = dht.DHT11(Pin(18))
- while True:
- try:
- sleep(2)
- sensor.measure()
- temp = sensor.temperature()
- hum = sensor.humidity()
- temp_f = temp * (9/5) + 32.0
- print('Temperatura: %3.1f C' %temp)
- print('Vlaznost: %3.1f %%' %hum)
- except OSError as e:
- print('DHT11 nedostupan')
Advertisement
Add Comment
Please, Sign In to add comment