Advertisement
Guest User

Untitled

a guest
May 1st, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. SAVEDIR=/home/pi/timelapse/img
  4. TIME_NIGHT_START=2035
  5. TIME_NIGHT_STOP=700
  6.  
  7.  
  8. # temp
  9. TEMP=$(cat /home/pi/temperature)
  10. HUM=$(cat /home/pi/humidity)
  11.  
  12.  
  13. now=$(date +"%k%M")
  14. filename=$(date -u +"%Y-%m-%d_%H%M-%S").jpg
  15.  
  16. # interval between 2 shots; should take in account the exposure time
  17. SLEEP_TIME=30
  18.  
  19. # time of exposure for night capture
  20. NIGHT_EXPOSURE_TIME=5
  21.  
  22. EXTRA_OPTIONS=${EXTRA_OPTIONS:=""}
  23.  
  24. FONT=/home/pi/timelapse/DroidSansFallback.ttf
  25.  
  26. if (( $now > $TIME_NIGHT_START)) || (($now < $TIME_NIGHT_STOP ))
  27. then
  28. EXTRA_OPTIONS="$EXTRA_OPTIONS -ISO 200 -ss $(( $NIGHT_EXPOSURE_TIME * 1000000 )) -ex night"
  29. fi
  30.  
  31. function take_picture {
  32. filename=$(date -u +"%Y-%m-%d_%H%M-%S").jpg
  33. /opt/vc/bin/raspistill -a 12 $EXTRA_OPTIONS -o $SAVEDIR/$filename
  34. convert -font $FONT -pointsize 60 -fill white -stroke black -strokewidth 2 -draw 'text 296,60 "Temp: $TEMP Hum: $HUM%"' $SAVEDIR/$filename $SAVEDIR/$filename
  35. }
  36.  
  37.  
  38. take_picture
  39.  
  40. echo Sleeping for $SLEEP_TIME seconds
  41. sleep $SLEEP_TIME
  42.  
  43. take_picture
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement