from machine import Pin
from time import sleep
Pir = Pin(4, Pin.IN)
Led = Pin(23, Pin.OUT)
while True:
if Pir.value() == 1:
Led.value(1)
print("Motion is detected!")
sleep(1)
Led.value(0)
else:
print("Motion is not detected!")
Led.value(0)
sleep(1)