Tuesday, March 24, 2015

77: More About* Time Lapse with the Pi Camera

For my last example (post 71) I used the timing/counting features of the raspistill command to record my image sequence. But this time I want to capture a JPEG per minute from sunrise to sunset. Here's the shell program I wrote:

ct=0
hr=`date +%H` # just the hour
while [ "$hr" -ge "07" ] && [ "$hr" -le "20" ] ; #e.g.: 7am to 8pm
do
  ct=`expr $ct + 1`
  num=`expr 0000$ct : '.*\(....\)$'`
  raspistill -w 1280 -h 720 -t 1 -o i${num}.jpg
  sleep 60
  hr=`date +%H`
done

The 2nd expr command makes sure that the $num variable is a zero-filled 4-digit number (required in the convert-to-movie step). Also, about 1975 I wrote the original UNIX expr command -- so I like to use it.

_______
* Did you know that when millions of English words were checked, the first (most common) 130 were all one syllable. The first two-syllable word was "about." Does that mean something? Trust me, "exactly" was way, way down the list.

No comments:

Post a Comment