Timed blink - IO Abstraction library example

By dave on October 20, 2017

Timed blink is a version of well known Arduino blink example that is shipped with the standard IDE, but is redesigned to use the Abstraction and timer library. Example circuit for the code is exactly the same a blink, and if you use the inbuilt LED pin (which it does by default) then there’s no need to build any circuit whatsoever. Instead of using delay() calls to set the duration of the led flash, it uses the task management library to schedule a task.

Rotary encoder with non-polling (interrupt based) switches from PCF8574

By dave on August 24, 2018

IoAbstraction has full support for interrupts on most devices, meaning we can connect a Rotary Encoder to an Arduino using a standard PCF8574 IO expander chip. In order to do this we need the PCF8574 /INT line to be connected to an Arduino pin that supports interrupts (such as pins 2 or 3). Further, you can also have switches handle push button input without polling, by initialising for interrupt, especially useful with IO exapnders.

IoAbstraction: Using a matrix keyboard / keypad

By dave on August 17, 2019

Matrix keyboards are arranged such that the keys are in a matrix of rows and columns. This means that instead of needing a spare input for each key, one INPUT for each column and one OUTPUT for each row is all that’s needed. In order to use the keyboard, we create a class of type MatrixKeyboardManager and configure it with an IoAbstractionRef, a KeyboardLayout that describes the keyboard attached (there are some standard ones already defined) and a listener that will be informed of changes.

Arduino Button presses that are handled like events

By dave on February 9, 2018

Have you ever wanted to treat button presses in Arduino similar to other languages, where you get an event callback when the switch is pressed? Look no further, the IO abstraction library can do that with very little fuss. In fact it can also do the same for rotary encoders as well, treating them similar to how scroll bars work in desktop applications. To start we need to get the IoAbstraction library and open the buttonRotartyEncoder example.

Liquid Crystal fork example using IO Abstraction library - examples

By dave on November 30, 2017

Recently, I have made a fork of Arduino LiquidCrystal (HD44780 display driver library) that allows the library to work with the IO abstraction library, meaning you can configure a display to use Arduino pins, an i2c 8574 IO expander or shift registers by simply changing one line of code in your sketch. There are two additional examples provided with this version that show how to use the fork with both a shift register and an 8574 i2c IO expander.

PCF8574 i2c - IO Abstraction library example

By dave on October 20, 2017

Here we demonstrate the IO Abstraction library on an Arduino with a PCF8574 i2c 8-bit IO expander chip. We use the device in order to receive input from a switch and light an LED. It’s about the most basic example possible that has both input and output. To use this example, first download the IoAbstraction library. Devices such as the PCF8574 provide an easy way to expand both input and output capabilities using a single chip, and because it’s on i2c, needs only two pins from the Arduino (SDA and SCL).

Touch screen support that works on all Arduino and mbed boards

By dave on May 15, 2021

IoAbstraction includes support for touch screens. The support is built in layers to allow for different drivers to be added over time. However, at the moment there is support for resistive touch screens on analog pins. This library can work with such touch screens regardless of analog input resolution, as long as the device is supported by IoAbstraction. As with switches and rotary encoder support, this component deals with debouncing the user input and also working out if the user has selected or held, therefore supporting drag operations.

IoAbstraction: Switches and rotary encoder documentation

By dave on November 15, 2018

Using SwitchInput for buttons and rotary encoders 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 an 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.

Troubleshooting and mock objects for testing

By dave on November 15, 2017

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. You simply introduce the logging abstraction between your regular abstraction and the device you’re having trouble with. For example: LoggingIoAbstraction loggingAbstraction(internalDigitalIo()); ComponentThatNeedsDebugging debugging(internalDigitalIo()); ComponentThatNeedsDebugging debugging(asIoRef(loggingAbstraction)); Mock objects for use with Unit testing This library itself is quite well tested using our simple test facilities, and further it makes unit testing your code easier.

Arduino digital input and output tutorial

By dave on July 25, 2017

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.

tcMenu for Arduino

This site uses cookies to analyse traffic, and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.

Send a message
X

Please use the forum for help with UI & libraries.

This message will be securely transmitted to our servers.