import time
from machine import Pin
PIR = Pin(27 , Pin.IN, Pin.PULL_DOWN)
led = Pin(4,Pin.OUT)
while True:
if PIR.value() == 1:
led.value(1)
print("Motion detected!")
else:
led.value(0)
print("No motion!")
time.sleep(1)