from machine import Pin
from time import sleep
led=Pin(2,Pin.OUT)
Sensor=Pin(34,Pin.IN)
while True:
if(Sensor.value()==1):
led.value(1)
print("Motion detected")
else:
led.value(0)
print("Motion not detected")
sleep(0.5)