Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e336c071bf | ||
|
|
8f00a5a941 | ||
|
|
9e3c27a8dc | ||
|
|
19f18f1a6b | ||
|
|
d25e59a877 |
20
main.py
20
main.py
@@ -13,11 +13,15 @@ GPIO.setup(22, GPIO.OUT) #LED output pin
|
|||||||
cwd = os.getcwd() #Sets the Current Working Directory
|
cwd = os.getcwd() #Sets the Current Working Directory
|
||||||
|
|
||||||
|
|
||||||
print("\nProgram Running!")
|
|
||||||
|
|
||||||
#To stabilize sensor and Camera
|
def bugmotion():
|
||||||
time.sleep(2)
|
GPIO.output(22, 0) #Sets light off
|
||||||
while True:
|
|
||||||
|
print("\nProgram Running!")
|
||||||
|
|
||||||
|
#To stabilize sensor and Camera
|
||||||
|
time.sleep(2)
|
||||||
|
while True:
|
||||||
|
|
||||||
#Waits for Motion from PIR Sensor
|
#Waits for Motion from PIR Sensor
|
||||||
pir.wait_for_motion()
|
pir.wait_for_motion()
|
||||||
@@ -39,6 +43,7 @@ while True:
|
|||||||
camera.capture(file_name)
|
camera.capture(file_name)
|
||||||
|
|
||||||
#Sets PIR Sensor back to waiting for motion
|
#Sets PIR Sensor back to waiting for motion
|
||||||
|
print("\nWaiting for no Motion!")
|
||||||
pir.wait_for_no_motion()
|
pir.wait_for_no_motion()
|
||||||
|
|
||||||
#Used to turn off the LED after 0.2 Secs
|
#Used to turn off the LED after 0.2 Secs
|
||||||
@@ -51,7 +56,12 @@ while True:
|
|||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
print("\nSystem Ready!")
|
print("\nSystem Ready!")
|
||||||
|
|
||||||
|
def exit_handler():
|
||||||
|
print('Program Shutting Down!')
|
||||||
|
GPIO.output(22, 0) # turns off LED
|
||||||
|
|
||||||
|
bugmotion() #Starts Program
|
||||||
|
atexit.register(exit_handler)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user