print("This device will detect motion")
print("Date : 22/11/2023")
print("By : M4trep")
#Import Libraries
from machine import Pin
from time import sleep
#Pin Declaration
LED_blinking_yellow = Pin(15,Pin.OUT)
LED_blinking_blue = Pin(2,Pin.OUT)
LED_blinking_red = Pin(4,Pin.OUT)
Motion_sensor = Pin(12,Pin.IN)
while True:
status_intruder = Motion_sensor.value()
if status_intruder == 1:
print("There is intruder!! HELP!!!")
for a in range(5):
LED_blinking_yellow.on()
sleep(0.5)
LED_blinking_yellow.off()
sleep(0.2)
LED_blinking_blue.on()
sleep(0.5)
LED_blinking_blue.off()
sleep(0.2)
LED_blinking_red.on()
sleep(0.3)
LED_blinking_red.off()
sleep(0.2)
else:
print("GADA PAPA DOANG, SANTAI BOSS SLEBEWWW")
LED_blinking_yellow.off()
LED_blinking_blue.off()
LED_blinking_red.off()
status_intruder = 0
sleep(2) # in every 2 second, check motion