OpenMenuOS abstracts hardware input so the rest of the menu system does not need to know whether the user is pressing discrete buttons or spinning a rotary encoder. You configure pins and voltage levels once duringDocumentation 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.
setup(), and the library translates raw GPIO signals into navigation events — scroll up, scroll down, select — for whichever screen is currently active.
The three logical buttons
Every navigation action maps to one of three logical inputs:| Logical input | Purpose |
|---|---|
| Up | Move selection to the previous item |
| Down | Move selection to the next item |
| Select | Confirm the current item / enter a sub-screen |
-1 disables that input entirely, which is useful when using an encoder for up/down and only a single button for select.
Pin configuration methods
You can assign or reassign pins after construction using the individual setter methods. This is handy when the encoder provides up/down and a separate GPIO provides select.Button voltage mode
By default the library expects buttons to pull the pin low when pressed. If your circuit pulls pins high on press (e.g., external pull-down resistors or active-high logic), set the mode to"High":
Rotary encoder support
A rotary encoder replaces the Up and Down buttons with a single rotating knob. Connect the encoder’s CLK and DT pins, then configure them withsetEncoderPin(). The encoder button (SW pin) acts as the Select input and is configured with setSelectPin().
setEncoderPin() is called. The encoder also works for navigating popup buttons — rotate to move between OK/Cancel, press to confirm.
When using an encoder, you do not need to call
setUpPin() or setDownPin(). The CLK/DT pair replaces both directional buttons.Input method comparison
- Rotary encoder
- Mixed inputs
Debouncing and long-press detection
The library handles debouncing internally for all button inputs. Raw GPIO reads are filtered so that a single physical press registers as exactly one navigation event, even on noisy hardware. Long-press detection is tracked per-screen using thepressedTime, releasedTime, and isLongDetected state variables on SettingsScreen. A long press on the Select button while inside a settings item triggers a special edit-lock release, letting the user commit a range value or exit a setting modification.
You do not need to implement debouncing or long-press timers in your own code. The library handles both transparently inside
handleInput().Reading raw button states
TheOpenMenuOS class exposes getter methods that return the configured pin numbers. These are informational — the library reads the GPIO states itself inside loop().