from machine import Pin
import utime
from machine import PWM
# Pin(Pin_number,
# pin_mode (IN, OUT, OPEN_DRAIN),
# Internal resistor pull value(PULL_UP OR PULL_DOWN),
# value (1 0r 0))
#
LED = Pin(14,Pin.OUT)
PIR = Pin(13,Pin.IN, Pin.PULL_UP)
LED.low()
utime.sleep(2)
while True:
motion = PIR.value()
print(motion)
if motion == 1:
print("motion detected")
LED.high()
utime.sleep(1)
else:
print("no motion detected")
LED.low()
utime.sleep(1)