Book Image

Raspberry Pi cookbook for Python programmers

Book Image

Raspberry Pi cookbook for Python programmers

Overview of this book

Table of Contents (18 chapters)
Raspberry Pi Cookbook for Python Programmers
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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:

The push button switch and other types of switches

Note

The switches used in the following examples are single pole single throw (SPST) momentary close push button switches. Single pole (SP) means that there is one set of contacts that makes a connection. In the case of the push switch used here, the legs on each side are connected together with a single pole switch in...