IoAbstraction: Switches and rotary encoder documentation
Using SwitchInput in your sketches SwitchInput is a button and rotary encoder management library that treats button presses and encoder adjustments as events, similar to web and UI applications. Supporting as many switches and rotary encoders as you need, in a completely event driven way, working along with TaskManagerIO to keep your code clean. Key points: Buttons using either pull down or pull up logic connected directly or via any supported IO expander De-bouncing of events on all buttons and encoders to significantly reduce duplicate callbacks.
IoAbstraction: troubleshooting and unit testing
Troubleshooting IO issues using LoggingIoAbstraction Within the MockIoAbstraction.h header there is an implementation of BasicIoAbstraction that delegates through a logging layer. If you are having difficulty determining what your code is sending and receiving, this could be useful. Unit testing support within the library This library itself is quite well tested using AUnit, and further it makes unit testing your code easier. There is a MockIoAbstraction that provides very easy support for mocking out an IoAbstraction.
Arduino digital input and output tutorial
In this tutorial and accompanying youtube video (left), I discuss how Arduino inputs and outputs work. Arduino 8 bit boards are mainly based on Atmel AVR chips, in fact the Mega is named after the chip number AVR-Mega-2560. Outputs on the AVR chips are much more versatile than they first look, and the video covers this in detail. If you are using an Arduino pro or other 3V3 based Arduino, replace the 5V mentioned here with 3V3.
Working with and de-bouncing switches for Arduino
When we press a button that’s connected to an Arduino input, it is likely that the button will momentarily “flicker” between the on and off state. This gives false readings for a short period of time after the button is pressed. Problems caused by this can range from the mild annoyance of a slight flicker, to doing something more than once that should have only happened once. Therefore we need a way to ignore these false readings; ensuring we only consider the button pressed or released when we know for sure that it is “stable”.