Change pin. Add try catch
This commit is contained in:
parent
a5547b3b45
commit
4b49cfc8b5
|
@ -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)
|
Loading…
Reference in New Issue