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 ...

Get Arduino Development Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.