Update main.py
This commit is contained in:
11
main.py
11
main.py
@@ -2,12 +2,17 @@ import RPi.GPIO as GPIO #Used to Import the LED
|
|||||||
import time #Used to allow wait times
|
import time #Used to allow wait times
|
||||||
from picamera import PiCamera #Used to import the Camera
|
from picamera import PiCamera #Used to import the Camera
|
||||||
from gpiozero import MotionSensor #Used to import the MotionSensor
|
from gpiozero import MotionSensor #Used to import the MotionSensor
|
||||||
|
import os
|
||||||
|
|
||||||
pir = MotionSensor(4)
|
pir = MotionSensor(4)
|
||||||
camera = PiCamera() #Camera Initialization
|
camera = PiCamera() #Camera Initialization
|
||||||
GPIO.setwarnings(False)
|
GPIO.setwarnings(False)
|
||||||
GPIO.setmode(GPIO.BCM) #Setting the GPIO Mode
|
GPIO.setmode(GPIO.BCM) #Setting the GPIO Mode
|
||||||
GPIO.setup(22, GPIO.OUT) #LED output pin
|
GPIO.setup(22, GPIO.OUT)
|
||||||
|
|
||||||
|
cwd = os.getcwd()
|
||||||
|
|
||||||
|
#LED output pin
|
||||||
|
|
||||||
|
|
||||||
#To stabilize sensor and Camera
|
#To stabilize sensor and Camera
|
||||||
@@ -23,7 +28,9 @@ while True:
|
|||||||
GPIO.output(22, 1)
|
GPIO.output(22, 1)
|
||||||
|
|
||||||
#Sets Img path and filename, Saves to USB Connected
|
#Sets Img path and filename, Saves to USB Connected
|
||||||
file_name = "/media/Capture_" + str(time.time()) + ".jpg"
|
print("File will be Saved in: " + cwd)
|
||||||
|
file_name = cwd + str(time.time()) + ".jpg"
|
||||||
|
|
||||||
|
|
||||||
#Used to wait for 0.1 Seconds for Camera to be ready
|
#Used to wait for 0.1 Seconds for Camera to be ready
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|||||||
Reference in New Issue
Block a user