Change pin. Add try catch

This commit is contained in:
Jimmy 2021-06-17 19:51:37 +12:00
parent a5547b3b45
commit 4b49cfc8b5
1 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,10 @@
import dht
import machine
d = dht.DHT11(machine.Pin(16))
d = dht.DHT11(machine.Pin(12))
try:
d.measure()
print(d.temperature())
print(d.humidity())
except Exception as e:
print(e)