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