print("Hello, This is PIR Sensor!")
print("Date: 22/1/2023")
print("Created by Awie")
#import libaries
from machine import Pin
from time import sleep
#pin declaration
GREEN1 = Pin(27,Pin.OUT)
GREEN2 = Pin(14,Pin.OUT)
RED = Pin(12,Pin.OUT)
PIR = Pin(13,Pin.IN)
while True:
Motion = PIR.value()
if Motion == 1:
print ('There is movement, BEWARE!')
for A in range (3):
GREEN1.off()
GREEN2.off()
RED.on()
sleep(0.5)
RED.off()
sleep(0.3)
else:
print('U are just fine')
for A in range (3):
RED.off()
GREEN1.on()
GREEN2.off()
sleep(0.5)
GREEN1.off()
GREEN2.on()
sleep(0.3)
Motion = 0