from machine import Pin
import time
import dht
led_temp = Pin(5, Pin.OUT)
led_humidity = Pin(15, Pin.OUT)  
sensor = dht.DHT22(Pin(14)) 

while True:
    sensor.measure()  
    temperature = sensor.temperature()  
    humidity = sensor.humidity() 
   
    if temperature > 40:
        led_temp.on()
    else:
        led_temp.off() 

    if humidity > 50:
        led_humidity.on() 
    else:
        led_humidity.off()  

    time.sleep(1)