Using the LEDDisplay library LEDDisplay is an easy to use library that makes light work of multi-digit 7segment displays. If you need help building the circuit or understanding the concepts, then refer to this guide: Arduino multiple digit, 7 segment display tutorial. Answering questions and getting help Get help from the community forum for LEDDisplay, or use the help widget (on the right) to contact us about commercial support on LEDDisplay Setting up the LEDDisplay library Before using any methods from the library, and usually in the global scope (outside of any function) you need to include the header file and initialise the library.
If you've got a 7 segment display but are not sure if it is common anode or common cathode, then you need to check the polarity of the display. This is easily done with a low voltage supply (9V or less) from a battery, bench PSU or Arduino board. Firstly and before anything else, connect a 1K resistor between the common pin and the battery. This will avoid potential damage to the LED's in the display.
From TcMenu 2.0 onwards all display plugins except Uno are customized using themes and render using properties and grids. For these renderers you can override the way that they draw in several ways. Firstly, lets start with a discussion of what’s possible. Firstly, icons can be used in place of actionable items, they are setup on a per menu-item basis. The colors, padding, orientation, and font for a menu item are now customisable at three levels: Default, Sub-menu, Item.
Setting up IO devices has been made much easier as of V2.2 of the designer software. you can now directly edit the IO expander configurations directly within tcMenu. When we discuss IO devices we are talking about IoAbstractionRef objects that refer to either device pins, or any other device such as I2C expanders or shift registers from the IoAbstraction library. In order to manage the IO Expanders that are available within a project you can do so from the Code menu -> Show Io Expanders.
IoAbstraction EEPROM support can be integrated into your menu application, it can be used to load and store menu item values, authentication and also choice menu items that are using EEPROM storage. Menu Manager makes it very easy to save values to EEPROM between runs. Each menu item can optionally have a storage point in the EEPROM area (-1 / 0xffff means not stored). Any items that have a valid EEPROM address will be persisted upon calling the save function on menuMgr, and similarly, will be read back by calling load.
You can secure both sub-menu items and remote connections using an Authenticator. In summary, when an authenticator is present on menuMgr any attempt to show a secure sub menu will result in a dialog asking for the pin; only proceeding to display the sub menu if the pin matches the on in authenticator. In addition, all remote/IoT connections will only be allowed if the authenticator approves the connection. An example of the secure sub-menu pin entry screen is below:
IoAbstraction 2.0 onwards has core I2C/Wire functionality provided by several functions, these abstract the use of I2C over Arduino and mbed, and over time the implementation of these will be improved, such that asynchronous behaviour will be possible on certain boards. Prior to 2.0, we had conditional I2C code scattered around the project, but now nearly all such functionality is separated out by platform, and sometimes even by board, we’ve made this available through the API, so you can use it too.
IoAbstraction contains a very simple collection that is relatively lightweight and works on a wide range of boards. It is a btree list that provides ordering and list storage. It works on anything from Arduino Uno upwards! It’s memory usage is very configurable, and the way it resizes arrays is also configurable too. You can set the initial size if you know how many items to expect, and do not wish for it to resize, or you can rely on platform defaults, for more general purpose cases.
TcMenu allows you to take over the display from the renderer very easily, once you own the display, you will be called back at regular intervals by the rendering class, and it is your responsibility to update the display at this time (if there are changes that require redrawing). You should never update the screen outside of these callbacks, as doing so would interfere with TcMenu rendering. There are two choices in this case, a functional approach based on providing a callback function, or an object oriented approach, where you provide an extension of CustomDrawing to the renderer.
MenuManager contains the functions to manage menu items, there is a global instance of this class called menuMgr. Here we present the most commonly used features, check out the reference docs for more details. There are a lot of iteration helper functions that can be used to navigate through menu structures. These are described further down the page. The following two reference documentation pages extend on the information here: Menu iteration reference docs MenuManager reference docs EEPROM support in menus Enabling next and back functionality To enable next, back or both, you provide the pin onto which you’ve connected the button for this function.