Tutorial WALKTHROUGH
(^144) The Official Raspberry Pi Projects Book raspberrypi.org/magpi
in The MagPi issue 49 (magpi.cc/49). It can be installed
from a command line by typing:
curl https://processing.org/download/
install-arm.sh | sudo sh
After reboot, it’ll then appear in the Raspbian menu
under Programming. As with all network programs,
you need to configure everything for your setup.
In this case you only need two IP addresses. In the
Processing code you need the IP address of the tablet,
and on the tablet you need to set the IP address of
the Pi. This is shown in Figure 1. As in a network, the
IP address can change from day to day, and it can be
tedious always having to change the configuration
before anything will work. You can get round this by
accessing your router and telling it to always give a
fixed IP address to both your Pi and your tablet.
The theatre
The theatre is simply a collection of graphics for the
backdrops, props, and actors. These ware taken mainly
from the story of Little Red Riding Hood in the Boston
Sunday Globe of 1895. Curiously, this did not include an
axe-carrying woodsman for the final scene, so we had
to take one from another story and eliminate his wife by
judicious use of the clone tool in our photo processing
package! Figure 2 shows the results of this process.
There are two actors in this story, and each one has
its own slider control. Each actor also has a number of
different costumes, with Riding Hood, in an amazing
show of virtuosity, also playing the part of the
woodsman, and Grandma’s head. This saves on sliders
and makes the control panel cleaner. There are two
‘heads’ for Grandma: one for talking to the Wolf, and
the other for when the Wolf is pretending to be her.
The movement controlled by the sliders is restricted
to a simple nod, which is operated by tapping on
opposite ends of the slider.
The elements are stacked up in a fixed order from
back to front, defining what will show in front of
what. A more complex setup could control this order,
at least for the actors and props, but we’re keeping
things simple. The main task in adapting the graphics
is to isolate the elements against a transparent
background. You need to use a PNG type file and not
a JPEG to define the transparent part. The image
files must be placed inside the data subfolder of your
Processing sketch’s folder, in the sketchbook folder.
The software
The structure of the Cutout_Theater.pde sketch is
quite simple. The Draw function runs repeatedly, and
if a change has been signalled by the DisplayUpdate
variable, it draws the new window. This prevents a lot
Fig 1:
HOST: Set this to the address of the Raspberry Pi.
Hover the pointer over the WiFi icon to find it.
LOCAL IP ADDRESS: The address to put in the software is:
String iPadIP = "192.168.1.69";