from time import sleep_ms, ticks_ms
from machine import I2C, Pin
import dht
sensor = dht.DHT22(Pin(27))
for i in range(100):
try:
sensor.measure()
temp = sensor.temperature()
print(temp)
hum = sensor.humidity()
except OSError as e:
print('Failed to read sensor.')