O'Reilly logo

Arduino Development Cookbook by Cornel Amariei

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

1,000 buttons to 1 pin

One button, one pin—that is the way things are usually done on Arduino boards. But it is so limiting. There are some tricks that let you connect more than one button to a pin. Actually, it is even possible to connect 1,000 buttons to just 1 pin. We will explore this possibility in this recipe.

Getting ready

The following are the ingredients required for this recipe:

  • An Arduino board connected to a computer via USB
  • A breadboard and jumper wires
  • Three buttons
  • Four resistors of equal value: 1K ohm works well

How to do it…

We implement a simple configuration using only three buttons on the same pin. Here are the steps:

  1. Connect the Arduino GND to a long strip on the breadboard. Also connect the Arduino 5V to a long strip.
  2. Connect one of ...

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