#write a micropython script to interface IR sensor with buzzer and led esp32.
from machine import Pin
from time import sleep
sensor = Pin(34,Pin.IN)
led = Pin(2,Pin.OUT)
buzzer = Pin(21,Pin.OUT)
while True:
if(sensor.value()==1):
led.on()
buzzer.on()
print("object detect")
else:
led.off()
buzzer.off()
print("object not detected")
sleep(0.5)