import dht
from machine import Pin
from time import sleep
dht_snsor = dht.DHT22(Pin(14))
led = Pin(15, Pin.OUT)
constant_temp = 20
count = 0
while True:
dht_snsor.measure()
temp = dht_snsor.temperature()
if count >= 4:
print (f'Temperature: {temp} c')
count = 0
print('------')
if temp > constant_temp :
led.value(1)
else:
led.value(0)
count = count + 1