Wednesday, October 16, 2013

Picture Script (Pi Camera Assignment)

Raspberry Pi Picture-take Script

As other students and groups worked on setting up the Raspberry Pi's with Raspbian and such, I took the time to create our script for taking pictures. The script, which is written in shell script (.sh file), is designed to take a photo, numbering each one starting from 1, put them in the pictures directory, and repeat every so many seconds.


To run:
- Paste the code into a text or .sh file (if you paste in a .txt, rename the extension to .sh, or it cannot be executed by the terminal)
- Change the repeat time and save directory to what you require
- Open the .sh file and click "Run" (not "Run in terminal")
if you're executing through terminal, cd to the directory (e.g. "cd /home/pi/Desktop), then do "./[SCRIPT NAME].sh
example:
cd /home/pi/Desktop
./script.sh

To close:
- Open task manager (should be under "Advanced" or something similar)
- Right click on [SCRIPT NAME].sh and click stop

Possible flaws:
- The script restarts the numbering each time it is run. If the script has been run before in the same directory and has taken pictures, it may overwrite the pictures in there as it takes more pictures.