Test Images
Before we start installing the image software, grab a few images to use as a test. You can use the Pi Zero's web browser to save some test images. Click the browser icon (a little Earth with cursor) to view this page on your Pi Zero (in case you're following along and a different device) and then download the three images shown below.
Do so by first clicking an image, which brings up the image asset page.
Then, right-click on the link marked Original and save the full-sized image to the Pictures directory in your user directory (the user directory is /home/pi by default).
Repeat these steps for all three images.
You can now close the web browser.
NOTE: Another great way to get images onto your Pi Zero is by setting up the Pi as a Samba server. This allows it to be discovered on your network, and then you can drag files onto it from another machine! Here's a great guide to setting up Samba.
Install and Configure feh
Feh is a very nice command line image viewer, that happens to be perfect for running a slide show with specific parameters. It also allows key commands to be used while running, which is how we'll be able to use the Joy Bonnet to trigger different events.
Let's install feh! Type this into the Terminal window, and then press return:
sudo apt-get install feh
This will download the necessary files and then install the application. When prompted, type Y and press return to continue.
Let's try out feh as a slide show viewer. Type this in the Terminal window (it may be easier to copy and paste it) and then press return:
DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --quiet --preload --randomize --full-screen --hide-pointer --slideshow-delay 5.0 /home/pi/Documents/testPics &
This will display the images in your /testPics directory, with the cursor hidden, fullscreen, and a with few other options. If you're curious about all of the options, you can press esc on the keyboard to stop the slideshow, and then type:
man feh
in your Terminal window and press return to read the manual page for feh. You can press q when you're done to quit man.
One thing you can do to clean up your code is to use short versions of the option flag names, as seen here:
DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -p -F -Y -D 5.0 /home/pi/Pictures &
This will do the same thing as the more verbose version above.
Script It
Instead of retyping that command every time you want to run a slideshow, you can create a special type of text file, known as a shell script, to store the command (or many commands). This shell script can then be invoked any time you want to run the commands contained within.
Create a new shell script with this command:
sudo nano /home/pi/start-picture-frame.sh
Once again, this will launch the nano text editor. Type this into the file:
#!/bin/bash
DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --quiet --preload --full-screen ---hide-pointer --slideshow-delay 15.0 /home/pi/Pictures &
The first line tells the system to run the rest of it as a bash shell command, so it knows what to expect.
Close and save the shell script by pressing ctrl-x and then Y and return.
Now, run the shell script -- which will in turn run all of the contents of the file -- by typing this:
bash /home/pi/start-picture-frame.sh
That just ran your slideshow with a much shorter command. Much easier!
Now, we'll set up the Joy Bonnet to use as a slideshow controller.
Text editor powered by tinymce.