From 4b49cfc8b579ca609992d3adddb21ecd2ab4b1a1 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 17 Jun 2021 19:51:37 +1200 Subject: [PATCH] Change pin. Add try catch --- dht11/dht11.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dht11/dht11.py b/dht11/dht11.py index b2d17eb..6abd762 100644 --- a/dht11/dht11.py +++ b/dht11/dht11.py @@ -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()) \ No newline at end of file +try: + d.measure() + print(d.temperature()) + print(d.humidity()) +except Exception as e: + print(e) \ No newline at end of file