Skip to content

Instantly share code, notes, and snippets.

@lesp
Last active November 9, 2016 16:51
Show Gist options
  • Save lesp/984f6c8284390812849400d9e353846a to your computer and use it in GitHub Desktop.
Save lesp/984f6c8284390812849400d9e353846a to your computer and use it in GitHub Desktop.
Take 20 pics using Picamera
from gpiozero import Button
from picamera import PiCamera
from datetime import datetime
from signal import pause
button = Button(18, pull_up=False)
camera = PiCamera()
def capture():
datetime = datetime.now().isoformat()
camera.capture('/home/pi/%s.jpg' % datetime)
print("Ready to take picture")
for i in range(20):
button.when_pressed = capture
pause()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment