import dht
import machine, time
d = dht.DHT22(machine.Pin(4))
while True:
d.measure()
temperature = d.temperature() # eg. 23.6 (°C)
humidity = d.humidity() # eg. 41.3 (% RH)
print('\n Temperature: ', str(temperature)+ "C")
print('\n Humidity: ', str(humidity)+"RH%")
time.sleep(.5)