from machine import Pin
import time
PIR_PIN = 12
LED_PIN = 2
BUZZER_PIN = 4
pir_sensor = Pin(12, Pin.IN)
led = Pin(2, Pin.OUT)
buzzer = Pin(4, Pin.OUT)
def motion_detected():
return pir_sensor.value() == 1
while True:
if (sensor.value()==1);
led.value(1)
buzzer.value(1)
print("Motion detected")
else:
led.value(0)
buzzer.value(0)
print("Motion not Detected")
time.sleep(0.1)