from machine import Pin, ADC
import utime
pir_pin = Pin(28, Pin.IN, Pin.PULL_DOWN)
led_pin = Pin(27, Pin.OUT)
buzzer = Pin(22, Pin.OUT)
led_pin.on()
while True:
motion_detected = pir_pin.value()
if motion_detected:
led_pin.on()
buzzer.on()
print("Motion detected!")
else:
led_pin.off()
buzzer.off()
print("No motion detected.")
utime.sleep(2)