Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created June 1, 2017 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kunigami/fd079b66b8dd536d0a1b4053cb164f21 to your computer and use it in GitHub Desktop.
Save kunigami/fd079b66b8dd536d0a1b4053cb164f21 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Get the timestamp of the image
imgTs=$(stat -c %Y images/image.jpg)
# 1 minute
waitSeconds=60
nextTime=$(($imgTs + $waitSeconds))
now=$(date +%s)
if [ "$now" -ge "$nextTime" ]; then
# Ready to take a new snapshot
raspistill -w 600 -h 400 -rot 180 -o images/image.jpg
echo $now
echo ' - done taking snapshot'
else
echo $now
echo ' - need to wait'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment