Change pin. Add try catch
This commit is contained in:
1 parent
a5547b3b45
commit
4b49cfc8b5
1 file changed
+7
-4
+7
-4
@@ -1,7 +1,10 @@
|
||||
import dht
|
||||
import machine
|
||||
d = dht.DHT11(machine.Pin(16))
|
||||
d = dht.DHT11(machine.Pin(12))
|
||||
|
||||
d.measure()
|
||||
print(d.temperature())
|
||||
print(d.humidity())
|
||||
try:
|
||||
d.measure()
|
||||
print(d.temperature())
|
||||
print(d.humidity())
|
||||
except Exception as e:
|
||||
print(e)
|
||||
Reference in new issue
Block a user