from machine import Pin
from time import sleep
from dht import DHT22
dht = DHT22(Pin(15))
while True:
# getting sensor readings
dht.measure()
temp = dht.temperature()
hum = dht.humidity()
# displaying values to the console
print("Temperature: " + str(temp) + "°C" + " Humidity: " + str(hum) + "%")
# read once every 2 secs
sleep(2)