-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStereoLapse-master.py
38 lines (29 loc) · 1.04 KB
/
StereoLapse-master.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'''This is the main script used to take timelapse imagery/image sequence'''
import RPi.GPIO as GPIO
from datetime import datetime
from picamera import PiCamera
#Set timer input GPIO
channel = 5
#Set button GPIO
button = 6
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.IN, pull_up_down = GPIO.PUD_UP)
GPIO.setup(button, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.add_event_detect(channel, GPIO.RISING, bouncetime=100)
GPIO.add_event_detect(button, GPIO.FALLING, bouncetime=300)
timelapse_on = False
while True:
if GPIO.event_detected(button):
timelapse_on = not timelapse_on
if GPIO.event_detected(channel) and timelapse_on:
camera = PiCamera()
#camera.resolution = (2592, 1944)
camera.resolution = (640, 480)
camera.awb_mode = 'off'
camera.awb_gains = (1.1, 1.1)
camera.iso = 200
camera.shutter_speed = 10000
tstamp = datetime.now()
print(f'Rising edge @{datetime.now()}')
camera.capture('/home/pi/Timelapse/left_%s.png' %tstamp)
camera.close()