O'Reilly logo

Raspberry Pi Cookbook for Python Programmers by Tim Cox

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Responding to a button

Many applications using the Raspberry Pi require that actions be activated without a keyboard and screen attached to it. The GPIO pins provide an excellent way for the Raspberry Pi to be controlled by your own buttons and switches without the need for a mouse/keyboard and screen.

Getting ready

You will need the following equipment:

  • 2x DuPont female to male patch wires
  • Mini breadboard (170 tie points) or a larger one
  • Push button to make a switch and momentary switch (or a wire connection to make/break the circuit)
  • Breadboarding wire (solid core)
  • 1k ohm resistor

The switches are as seen in the following diagram:

Getting ready

The push button switch ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required