from machine import Pin
from time import sleep
from dht import DHT22
Sensor=DHT22(Pin(15))
def f():
sensor.measure()
h=sensor.humidity()
t=sensor.temperature
return h,t
while True:
try:
h,t=f()
print('hum=',h)
print('tem=',t)
exept:pass