From 3a961af1f88adeae4216abfa01e3ba6988b9cc09 Mon Sep 17 00:00:00 2001 From: Jordan-Fielding <107819004+Jordan-Fielding@users.noreply.github.com> Date: Fri, 15 Jul 2022 10:51:09 +1000 Subject: [PATCH] Update main.py --- main.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/main.py b/main.py index ad506b4..594e51f 100644 --- a/main.py +++ b/main.py @@ -1,12 +1,12 @@ import RPi.GPIO as GPIO #Used to Import the LED import time #Used to allow wait times from picamera import PiCamera #Used to import the Camera -from gpiozero import MotionSensor #Used to import the MotionSensor + from datetime import datetime -from subprocess import call + import os -pir = MotionSensor(4) + camera = PiCamera() #Camera Initialization GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) #Setting the GPIO Mode @@ -31,15 +31,10 @@ def bugmotion(): break - #To stabilize sensor and Camera + #To stabilize the Camera time.sleep(2) while True: - #Waits for Motion from PIR Sensor - pir.wait_for_motion() - - print("\nBug detected") - #Turns on the LED Flash GPIO.output(22, 1) @@ -60,19 +55,15 @@ def bugmotion(): #Saves File camera.capture(completeFilePath) - #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 time.sleep(0.2) #Used to turn off the LED GPIO.output(22, 0) - #Used to stabilize Sensor and allow the Camera to refocus - time.sleep(2) - print("\nSystem Ready!") + #Used to wait 5 minutes for camera to take a photo + time.sleep(300) + print("\nTaking photo!") def exit_handler(): print('Program Shutting Down!')