#DHT11 Digital Temperature and Humidity Sensor
from machine import Pin
from time import sleep_ms
import dht
d = dht.DHT11(Pin(23))
led = Pin(2, Pin.OUT)
while True:
try:
d.measure()
temp = d.temperature() #( ํC)
humid = d.humidity() #(% RH)
print('Temp:', temp, ' Humid:', humid)
sleep_ms(1000)
except OSError as e:
print('Failed to read sensor!')