import dht
from machine import Pin
from time import sleep
sensor=dht.DHT22(Pin(16))
led1=Pin(8,Pin.OUT)
led2=Pin(7,Pin.OUT)
led3=Pin(6,Pin.OUT)
while True:
sensor.measure()
temp=sensor.temperature()
print("Temperature:",temp,"C")
if temp<25:
led3.on()
led1.off()
led2.off()
print("the temperature is cool!")
elif temp>25 and temp<=50:
led2.on()
led1.off()
led3.off()
print("the temperature is warm!")
else:
led1.on()
led2.off()