Working with Buttons

In this section you’ll learn how pushbuttons work in principle and how you can use them with an Arduino. We’ll start small and build a circuit that uses a pushbutton to control a single LED.

What exactly is a pushbutton? The following figure shows three views of a typical pushbutton. It has four connectors that fit perfectly on a breadboard (at least after you have straightened them with a pair of pliers). Two opposite pins connect when the button is pushed; otherwise, they are disconnected.

images/buttons.png

The following picture shows a simple circuit using a pushbutton. Connect pin 7 (chosen completely arbitrarily) to the pushbutton, ...

Get Arduino: A Quick-Start Guide, 2nd 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.