An I2C LCD backpack based on the PCF8574 chip provides an easy way to get started with LiquidCrystalIO on most Arduino boards. It is usually in one of two configurations as listed below. This library works correctly with the display and even has a shorthand way of creating the LCD for this case. Connectivity combinations for i2c backpacks Pin Option1 Option2 0 RS EN 1 RW RW 2 EN RS 3 Backlight Backlight 4 D4 D4 5 D5 D5 6 D6 D6 7 D7 D7 Construction for Option 1 outside of any functions (global):
There are often cases when you’ll need to run a micro controller from a battery power source. Unlike when running from mains power, every milli-amp matters. In these cases IoAbstraction’s task manager is able to integrate easily with most low power libraries. Task manager works by repeatedly calling the runLoop() function within loop() or main, during each loop task manager evaluates if any tasks are yet ready to run, and if they are it runs them.
TcMenu supports a wide range of rendering devices, from HD44780 based units using our LiquidCrystal fork through to mono OLED’s and full colour TFT displays using the Adafruit_GFX library. In order to achieve such a wide range of displays the renderer describes things in terms of menu items, active positions, editors and dialogs. This allows each renderer to convert these concepts into something that works for its needs. You can also easily take over the display to draw your own screen at any time.
Using a matrix keyboard with TcMenu is straightforward, we use the IoAbstraction Keyboard Manager component to handle the keyboard, along with a custom listener for tcMenu that feeds the menu manager with appropriate events upon key presses. This library allows you to connect your keyboard either using Arduino pin, or any supported IoAbstraction such as the I2C PCF8574 or MCP23017. Setting up the menu sketch for a Matrix Keyboard Step 1 is to wire up your keyboard in accordance with the above linked keyboard manager page, I recommend at this point testing it through the packaged IoAbstraction example.
TcMenu has considerable out of the box remote connectivity on both Arduino and mbed. With support for Ethernet2 library, UipEthernet library, ESP8266 WiFi, ESP32 WiFi and Serial (including Bluetooth Serial) to name a few connectors. Please pay close attention to the following classes in the reference documentation as they are mentioned frequently here: BaseRemoteServerConnection in reference docs TcMenuRemoteService in reference docs. Please bear in mind that TcMenu is able to support a wide range of remote connectors.
Sometimes the situation arises where a product is built (or gets close to being built), before any concerns about it’s stability are discussed or proper planning arranged. Often this leads to code being written without any proper test plan in place. Combined with very tight deadlines there’s often even no plan to go back and fix things up. Once this situation occurs, it’s probable that the product release will be compromised.
In part 2 of this series we discuss how sketches compile on Arduino, along with the cost of using the virtual keyword to create virtual classes. Some things are not quite as clear cut as may be initially thought, especially in the very low memory environment of the ATMega328 (Arduino Uno). Lastly we discuss the memory usage of Wire and how to reduce it. If you’ve not read static memory analysis for Arduino - part 1 then I recommend reading that first, as it sets the background for this article.
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.
Worked example: Building a timer For this example we will create a menu that has two top level menu items; a counter which counts down from the selected value, and a Boolean switch that turns on or off the countdown. It will also have a submenu with one menu item to control the notification method. So lets draw this out conceptually below menu root +- countdown, integer values 0 to 1000 seconds +- enabled, boolean YES, NO.
Measuring voltage from an analog input. Following on from the previous example ( example for driving 7 segment LED displays ). we now build on the same circuit to make a simple voltage meter. Additional requirements: Potentiometer of at least 10Kohms. In order to measure voltage, we need to use an Arduino board analog input. Usually these are marked separately as “analog in”. We are going to use a potentiometer to adjust the voltage at the analog input.