This guide walks through theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/The-Young-Maker/OpenMenuOS/llms.txt
Use this file to discover all available pages before exploring further.
OpenMenuOS_Simple example sketch step by step. By the end you will have a working menu with settings, sub-screens, and popup dialogs running on your ESP32 or ESP8266.
Wire the hardware
OpenMenuOS relies on TFT_eSPI for display communication — pin assignments for SPI, DC, CS, and RST are set in TFT_eSPI’s
Pass
User_Setup.h, not in your sketch.For input, you need to know which GPIO pins your buttons or encoder are connected to. The example below uses a rotary encoder:| Signal | GPIO (example) |
|---|---|
| Encoder CLK | 5 |
| Encoder DT | 2 |
| Encoder button (SELECT) | 19 |
-1 for any button pin you don’t have connected.If you’re using buttons instead of an encoder, pass all three pins directly to the
OpenMenuOS constructor: OpenMenuOS menu(BTN_UP, BTN_DOWN, BTN_SELECT). With an encoder, construct the object without arguments and call setEncoderPin() and setSelectPin() in setup().Include the library and declare objects
At the top of your sketch, include the library and create one instance of
OpenMenuOS plus one screen object for each screen you need.MenuScreen, SettingsScreen, and CustomScreen all accept an optional title string. The title appears at the top of the screen when the menu is rendered.Configure screens in setup()
Build the menu hierarchy, configure appearance, and call
menu.begin() to initialize the display.menu.begin() initializes TFT_eSPI, draws the boot screen if configured, and renders the main menu for the first time.Drive the loop
Your
loop() function must call PopupManager::update() every iteration, then menu.loop(). PopupManager::update() returns the result of any active popup interaction.Add settings
SettingsScreen supports four setting types. Add them in setup() before calling menu.begin().Show a popup from a callback
Attach an Then wire the callbacks to menu items:The five available popup types and their default behaviors:
ActionCallback function to any menu item. When the user selects that item, the library calls your function. Trigger any popup type from inside the callback.| Function | Type | Auto-close |
|---|---|---|
PopupManager::showInfo() | Info (blue) | No |
PopupManager::showSuccess() | Success (green) | Yes, 3 s |
PopupManager::showWarning() | Warning (orange) | No |
PopupManager::showError() | Error (red) | No |
PopupManager::showQuestion() | Question (cyan) | No — returns OK or CANCEL |
What to read next
- Introduction — full feature list and hardware requirements
- Installation — Library Manager and ZIP install instructions