volts). Most of the remaining pins (such as GPIO02 or
GPIO18) are ones you can use to output or read input in
the form of electricity. The pins labeled “Ground” provide
a return path for the electrical current. Numbering of the
pins is done in the same fashion you read text in a book —
left to right before moving down. You already have the
code for capturing stills with the camera module. Let’s
walk through how to set up the circuit and program.

The next few
lines simply set up
and define some
of the
components that
the program will
be using.
buttonPin = 7,

count = 0, and buttonPress = True define variables;
specifically, the number of the pin we are using to read
input, how many stills you’ll take, and the state of the
button (whether it’s being pressed or not).

Refer to Figure 19 and Figure 20 for the circuit. This is
about as simple as it gets with the top wire connected to
pin 6 and the bottom wire connected to pin 7.

GPIO.PUD_UP) prepare the pins for use. The most
important part here is that pin 7 is being coded to read
input. You’ve seen camera = PiCamera() before.

Here are the basics of the program that we will use.
Note that the program allows you to take one still
photograph which it saves to the Pi desktop (see
Resources). Let’s walk through it quickly so that you have
an intuitive understanding of its contents: