5 Commits

Author SHA1 Message Date
Jordan-Fielding
e336c071bf Update main.py 2022-07-07 10:59:04 +10:00
Jordan-Fielding
8f00a5a941 Update main.py 2022-07-07 10:56:47 +10:00
Jordan-Fielding
9e3c27a8dc Update main.py 2022-07-07 10:42:48 +10:00
Jordan-Fielding
19f18f1a6b Update main.py 2022-07-07 10:40:35 +10:00
Jordan-Fielding
d25e59a877 Update main.py 2022-07-07 10:35:45 +10:00

12
main.py
View File

@@ -13,6 +13,10 @@ GPIO.setup(22, GPIO.OUT) #LED output pin
cwd = os.getcwd() #Sets the Current Working Directory
def bugmotion():
GPIO.output(22, 0) #Sets light off
print("\nProgram Running!")
#To stabilize sensor and Camera
@@ -39,6 +43,7 @@ while True:
camera.capture(file_name)
#Sets PIR Sensor back to waiting for motion
print("\nWaiting for no Motion!")
pir.wait_for_no_motion()
#Used to turn off the LED after 0.2 Secs
@@ -51,7 +56,12 @@ while True:
time.sleep(2)
print("\nSystem Ready!")
def exit_handler():
print('Program Shutting Down!')
GPIO.output(22, 0) # turns off LED
bugmotion() #Starts Program
atexit.register(exit_handler)