It is possible to build multi level menus with an OLED display on an Arduino Uno or other low memory board provided you use SSD1306Ascii instead of the U8G2 library, as it uses a lot less memory at the cost of some flexibility. We’ve tested it with regular I2C SH1106 OLED display units and it works absolutely fine.
To use this library, you create the variable globally in your sketch, and then reference it in the code generator properties, the code generator will not create the display object for this type of display.
There are some limitations, firstly it is assumed that you will use a fixed width font for the menu drawing (you can use proportional fonts for the title), this is to ensure we know how wide the menu will be on the display. Don’t forget we’re not drawing this into a buffer, it is going straight onto the screen, and the screen is treated as an ASCII drawing area. This is not the case with the U8G2 plugin.
We recommend before proceeding that you familiarize yourself with the underlying SSD1306ASCII library.
You’d then create the display variable globally within your sketch, and initialise it before the call to setupMenu()
in setup()
.
With this done, the menu should appear on the display once the sketch is uploaded.
Display Variable Name
this is the name of the display variable you created above.Display Variable Type
this is the exact type of the display variable you created above.Char Width
defines the number of characters across the displayTitle font
the font to use for the title, take care to determine the size of each font carefully on low memory boardsItem font
the font to use for menu items, take care to determine the size of each font carefully on low memory boardsThis should be all that’s needed to get up and running with this display. There’s also an example packaged with tcmenu library.