from machine import Pin
import dht
sensor = dht.DHT22(Pin(13))
led1= Pin(15, Pin.OUT)
led2= Pin(2, Pin.OUT)
led3= Pin(4, Pin.OUT)
while True:
sensor.measure()
t= sensor.temperature()
h= sensor.humidity()
print("Temperatura:", t)
print("Humedad:", h)
if t<30:
led1.on()
else:
led1.off()
if h<40:
led2.on()
else:
led2.off()
if h>50 and t>60:
led3.on()
else:
led3.off()