Skip to content

Instantly share code, notes, and snippets.

@AO8
Created April 6, 2017 19:20
Show Gist options
  • Save AO8/c7fa73648318b7cfc8169bb7f3713537 to your computer and use it in GitHub Desktop.
Save AO8/c7fa73648318b7cfc8169bb7f3713537 to your computer and use it in GitHub Desktop.
Timelapse photo with timestamp Python script for Raspberry Pi
from picamera import PiCamera, Color
from time import sleep
import datetime as dt
camera = PiCamera()
# 8 hour timeplase with image taken every 10 seconds
for i in range(2880):
camera.annotate_background = Color("black")
camera.annotate_text = dt.datetime.now().strftime("PiLapse %m-%d-%Y %H:%M:%S")
camera.capture("/home/pi/img{0:04d}.jpg".format(i))
sleep(10)
camera.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment