#micro python script to interface the IR sensor with ESP32
from machine import Pin
import time
pirs= Pin(2, Pin.IN)
buzzer = Pin(5, Pin.OUT)
led= Pin(14, Pin.OUT)
while True:
obj = pirs.value()
if obj:
print("Object detected")
buzzer.on()
led.on()
else:
print("No object detected")
buzzer.off()
led.off()
time.sleep(0.5)