from machine import Pin
from time import sleep
import dht
sensor = dht.DHT22(Pin(4))
while True:
sleep(2)
sensor.measure()
temp_c = sensor.temperature()
hum = sensor.humidity()
temp_f = temp_c * 9/5 + 32
print("Temperature is:", temp_c, "C /", temp_f, "F")
print("Humidity is:", hum, "%")