from machine import Pin
from time import sleep
import dht
Ledr=Pin(21,Pin.OUT)
Ledv=Pin(25,Pin.OUT)
Ledb=Pin(22,Pin.OUT)
cap=Pin(26,Pin.IN)
d=dht.DHT22(cap)
while True:
d.measure()
t=d.temperature()
print("temperature=",t,"c")
if t <14:
Ledr.on()
elif 14<=t<20:
Ledb.on()
else:
Ledv.on()
sleep(5)