Hardware Reference
In-Depth Information
Figure 15-9:
The complete
timelapse.
sh script, in the
nano text
editor
Although this brings the script to a close, the loop used is known as an infinite loop : the
instruction while true at the start tells the script to run through the loop until true
becomes false, or 1 becomes 0. Because this can never happen, the script runs forever—
taking an image every 30 seconds.
Save the file by pressing Ctrl + O, and then change the file's permissions to make it executable
with the following command:
chmod +x timelapse.sh
For more information on file permissions, see Chapter 3, “Linux System Administration”.
Finally, run the script with the following command:
./timelapse.sh
The script will immediately take a picture and print the status message “Image captured” to
the console (see Figure 15-10). After 30 seconds, it will take another picture; after another
30 seconds, a third. This will continue forever, or until your SD card is filled with images. To
exit the script, press Ctrl + C.
 
Search WWH ::




Custom Search