Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- SAVEDIR=/home/pi/timelapse/img
- TIME_NIGHT_START=2035
- TIME_NIGHT_STOP=700
- # temp
- TEMP=$(cat /home/pi/temperature)
- HUM=$(cat /home/pi/humidity)
- now=$(date +"%k%M")
- filename=$(date -u +"%Y-%m-%d_%H%M-%S").jpg
- # interval between 2 shots; should take in account the exposure time
- SLEEP_TIME=30
- # time of exposure for night capture
- NIGHT_EXPOSURE_TIME=5
- EXTRA_OPTIONS=${EXTRA_OPTIONS:=""}
- FONT=/home/pi/timelapse/DroidSansFallback.ttf
- if (( $now > $TIME_NIGHT_START)) || (($now < $TIME_NIGHT_STOP ))
- then
- EXTRA_OPTIONS="$EXTRA_OPTIONS -ISO 200 -ss $(( $NIGHT_EXPOSURE_TIME * 1000000 )) -ex night"
- fi
- function take_picture {
- filename=$(date -u +"%Y-%m-%d_%H%M-%S").jpg
- /opt/vc/bin/raspistill -a 12 $EXTRA_OPTIONS -o $SAVEDIR/$filename
- convert -font $FONT -pointsize 60 -fill white -stroke black -strokewidth 2 -draw 'text 296,60 "Temp: $TEMP Hum: $HUM%"' $SAVEDIR/$filename $SAVEDIR/$filename
- }
- take_picture
- echo Sleeping for $SLEEP_TIME seconds
- sleep $SLEEP_TIME
- take_picture
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement