from machine import Pin
import time
pir_sensor = Pin(28, Pin.IN)
led = Pin(1, Pin.OUT)
while True:
if pir_sensor.value() == 1:
led.on()
print("Motion detected! LED ON.")
else:
led.off()
print("No motion. LED OFF.")
time.sleep(0.1)