Responding to a button

Many applications using the Raspberry Pi require that actions are 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 a mouse/keyboard and screen.

Getting ready

You will need the following equipment:

  • 2 x DuPont female to male patch wires
  • Mini breadboard (170 tie points) or a larger one
  • Push button switch (momentary close) 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 and other types of switch ...

Get Raspberry Pi for Python Programmers Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.