Change pin. Add try catch

This commit is contained in:
jimmy committed 2021-06-17 19:51:37 +12:00
1 parent a5547b3b45
commit 4b49cfc8b5
1 file changed
+7 -4
+7 -4
View File
@@ -1,7 +1,10 @@
import dht import dht
import machine import machine
d = dht.DHT11(machine.Pin(16)) d = dht.DHT11(machine.Pin(12))
d.measure() try:
print(d.temperature()) d.measure()
print(d.humidity()) print(d.temperature())
print(d.humidity())
except Exception as e:
print(e)