from machine import Pin
from time import sleep
pir = Pin(6, Pin.IN)
led = Pin(15, Pin.OUT)
print("pir motion")
while True:
if pir.value()== 1 :
print("Motion detected!")
led.value(1)
sleep(2)
else:
led.value(0)