from machine import Pin
import time
pir = Pin(15, Pin.IN)
led = Pin(26, Pin.OUT) # onboard LED (optional)
while True:
if pir.value() == 1:
print("Motion Detected!")
led.on()
else:
print("No Motion")
led.off()
time.sleep(0.5)