from machine import Pin
from time import sleep
LED1 = Pin(14, Pin.OUT)
LED2 = Pin(0, Pin.OUT)
LED3 = Pin(1, Pin.OUT)
LED4 = Pin(2, Pin.OUT)
LED5 = Pin(3, Pin.OUT)
PIR_sensor = Pin(13, Pin.IN, Pin.PULL_UP)
LED1.low()
LED2.low()
LED3.low()
LED4.low()
LED5.low()
sleep(0.1)
while True:
print(PIR_sensor.value())
if PIR_sensor.value() == 0:
print("Motion Detected! -> LED is now OF")
LED1.low()
LED2.low()
LED3.low()
LED4.low()
LED5.low()
sleep(1)
else:
print("No motion detected -> LED is ON")
LED2.high()
sleep(1)
LED2.low()
sleep(1)
LED3.high()
sleep(1)
LED3.low()
sleep(1)
LED4.high()
sleep(1)
LED4.low()
sleep(1)
LED5.high()
sleep(1)
LED5.low()
sleep(1)
LED1.high()
sleep(1)
LED1.low()
sleep(1)