Created
May 9, 2018 18:28
-
-
Save varunmehta/8e41fc1173d59efa180bc77126882c22 to your computer and use it in GitHub Desktop.
Pi to click pics every 5 seconds.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run the file on boot; | |
# | |
# nano /etc/crontab | |
# @reboot root /path/to/script.sh | |
# | |
from picamera import PiCamera | |
from time import sleep | |
import time | |
import os | |
# Purpose of this program is to keep clicking photos, | |
# till storage is full or the pi is unplugged. | |
camera = PiCamera() | |
FILE_PATH='/home/pi/poker' | |
# create dir first time | |
if not os.path.exists(FILE_PATH): | |
os.makedirs(FILE_PATH) | |
# initalize camera | |
camera.start_preview() | |
sleep(10) | |
# infinite loop to click pictures | |
while True: | |
file_name = int(round(time.time())) | |
camera.capture(FILE_PATH + '/' + file_name + '.jpg') | |
# click a picture every 5 seconds. | |
sleep(5) | |
camera.stop_preview() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Moved as a resin.io project to https://github.com/varunmehta/intervalometer