from machine import *
from time import *
p=Pin(2,Pin.IN)
led=Pin(23,Pin.OUT)
while True:
value=p.value()
print(value)
if(value==1):
led.on() #led.value(1)
print('motion detected')
elif(value==0):
led.off() #led.value(0)
sleep(0.5) #1/2 second