print("Program for Motion Detection")
print("Date : 4/11/2024")
print("by jd")
#Import modules/libraries
from machine import Pin
from utime import sleep
#Pin Declaration
PIR_pin = Pin(13, Pin.IN)
RedLED_pin = Pin(2,Pin.OUT)
#Parameter Declaration
#Main Program
while True :
PIR_value = PIR_pin.value() #.value = digital .read = analog
print("\nThe motion status is ", PIR_value)
print("----------------------------------")
if PIR_value == 1:
for m in range (5):
RedLED_pin.on()
sleep(0.5)
RedLED_pin.off()
sleep(0.5)
else:
RedLED_pin.off()
PIR_value = 0 #Iniatialize the sensor value
sleep(1)