micropython-examples/dht11/dht11.py

10 lines
165 B
Python
Raw Normal View History

2021-04-06 04:12:58 +00:00
import dht
import machine
2021-06-17 07:51:37 +00:00
d = dht.DHT11(machine.Pin(12))
2021-04-06 04:12:58 +00:00
2021-06-17 07:51:37 +00:00
try:
d.measure()
print(d.temperature())
print(d.humidity())
except Exception as e:
print(e)