Hardware Reference
In-Depth Information
Write out the file to /usr/bin/camloop.sh . You'll need to make it executable, too, which
can be accomplished by running:
$ sudo chmod +x /usr/bin/camloop.sh
You can execute this script and confirm that indeed, it displays the camera on the TFT
screen at the desired resolution and bitrate in a never-ending loop. To end it, just hit
Control-C and the script will die.
We recommend that you configure this script to run automatically on boot, since
you're not likely to have a keyboard connected to your costume when you're showing
this off. The procedure to do this varies by distribution.
For Raspbian, you simply need to invoke this script from /etc/rc.local . Open that file
with a text editor (as root), and add this line directly above the line that says exit 0 :
/usr/bin/camloop.sh &
The use of the & command at the end of the line tells the Python script to run in the
background. This is important, because otherwise, rc.local would wait for it to finish
before proceeding. Since this script runs in an infinite video loop, it would never pro-
ceed, and your boot process would sit there waiting.
Pidora uses a different boot software ( systemd ), which does not use the rc.local
concept. As a result, you will need to create a new systemd service file for the Python
script. Copy this file (also in the topic's GitHub repository) to /usr/lib/systemd/
system/camloop.service (as root):
[Unit]
Description=Camera Loop
[Service]
Type=simple
ExecStart=/usr/bin/camloop.sh
[Install]
WantedBy=multi-user.target
Then, you can start it immediately by running:
$ su -c 'systemctl start camloop.service'
To make this service start on each boot, run:
$ su -c 'systemctl enable camloop.service'
Search WWH ::




Custom Search