Switches as User Input Devices

KeySwitchThe humble switch is one of the major ways that users can interact with Arduino based code. Often the input comes from some variation of the momentary-on push switch, like the tact switch on the left, connected to an input on the microcontroller.

Users of modern GUIs will be familiar with being able to express themselves through a keyboard and a mouse. So user interface elements like double-clicks, long clicks and keyboard auto-repeat are familiar.

However, a lot of microcontroller code simply restricts the use of these switches to on/off functionality. Arduino programmers often don’t understand how to provide more features, even though a single switch can be made to do much more for a user.

Continue reading “Switches as User Input Devices”

Read 100 Switches with 3 Digital Pins!

4017_KM 3x3 Matrix Finished ProductFor various reasons, digital I/O pins are always at a premium when implementing micro controller projects. There have been various multiplexing schemes described to allow more than one switch to be connected to a small number of pins, but some time ago I came across a very simple but highly scalable method that uses the 4017 decade counter to connect many switches (more than 100 if needed) to just 3 digital inputs.

Continue reading “Read 100 Switches with 3 Digital Pins!”