#write a micropyhton code to control 2 led when the temp is less than 25 degree turn on AC which is LED 1 and if the temp is more than 25 degree turn on led 2
from machine import Pin
from time import sleep
import dht
sensor = dht.DHT22(Pin(14))
led_pin_1 = 23  #FOR AC
led_pin_2 = 21  #FOR ROOM HEATER
led_1 = Pin(led_pin_1, Pin.OUT)
led_2 = Pin(led_pin_2, Pin.OUT)

while True:
    sensor.measure()
    temp = sensor.temperature()
    print('Temperature in C: ', temp, 'C')
    if temp < 25:
        led_1.on()
        led_2.off()
        print("Temperature is less than 25°C. AC is ON.")
    else:
        led_1.off()
        led_2.on()
        print("Temperature is 25°C or higher. LED 2 is ON.")
    sleep(2)
Loading
esp32-devkit-c-v4
dht1:VCC
dht1:SDA
dht1:NC
dht1:GND
led1:A
led1:C
led2:A
led2:C