-
-
Save fish2000/3114521 to your computer and use it in GitHub Desktop.
Simple script to run a timelapse on a canon camera from a raspberry pi with an attached HD44780 display
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
from hd44780 import HD44780 | |
import ctypes | |
from time import sleep | |
class CameraFilePath(ctypes.Structure): | |
_fields_ = [('name', (ctypes.c_char * 128)), | |
('folder', (ctypes.c_char * 1024))] | |
gp = ctypes.CDLL('libgphoto2.so.2') | |
context = gp.gp_context_new() | |
camera = ctypes.c_void_p() | |
gp.gp_camera_new(ctypes.pointer(camera)) | |
gp.gp_camera_init(camera, context) | |
cam_path = CameraFilePath() | |
lcd = HD44780() | |
while 1: | |
for i in reversed(range(1,4)): | |
lcd.clear() | |
lcd.message('taking picture\n in %s seconds' % i) | |
sleep(1) | |
lcd.clear() | |
lcd.message('Capturing...') | |
gp.gp_camera_capture(camera, 0, ctypes.pointer(cam_path), context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment