from machine import Pin, PWM
import time
led=Pin(4, Pin.OUT)
pir=Pin(13, Pin.IN, Pin.PULL_DOWN)
buzer=PWM(Pin(15))
while True:
if pir.value():
print("Movimiento detectado")
led.on()
time.sleep(1)
buzer.freq(260)
else:
print("No hay movimiento")
led.off()
time.sleep(1)
buzer.freq(1)