LcdMenu is an open-source Arduino library for creating menu systems. It is designed to be easy to use and flexible enough to support a wide range of use cases.
With LcdMenu, you can create a menu system for your Arduino project with minimal effort. The library provides a simple API for creating menus and handling user input. There are also a number of built-in display interfaces to choose from, including LCD displays and OLED displays (coming soon).
LcdMenu is a simple but powerful library for creating menu systems on embedded devices. It is designed to be easy to use and to work with a wide range of display interfaces and provide various helpers for handling user input like rotary encoders and buttons.
Follow this guide to install the library with Arduino Library Manager or install it with PlatformIO using the steps below:
-
Open the PlatformIO IDE or VSCode with PlatformIO extension installed.
-
Create a new project or open an existing one.
-
Add the LcdMenu library to your project by adding the following line to your
platformio.ini
file:lib_deps = forntoh/LcdMenu@^5.0.0
-
Save the changes to the
platformio.ini
file. -
Build and upload your project to your device.
To create a menu system with LcdMenu, you need to define a menu structure, a display interface, and an input method to interact with the menu. For this example, we will use the LiquidCrystal_I2C
display interface and KeyboardAdapter
for user input to read from the serial monitor. You can replace these with other display interfaces and input methods as needed or create your own.
#include <LcdMenu.h>
#include <MenuScreen.h>
#include <display/LiquidCrystal_I2CAdapter.h>
#include <input/KeyboardAdapter.h>
MENU_SCREEN(mainScreen, mainItems,
ITEM_BASIC("Item 1"),
ITEM_BASIC("Item 2"),
ITEM_BASIC("Item 3"),
ITEM_BASIC("Item 4"));
LiquidCrystal_I2C lcd(0x27, 16, 2);
LiquidCrystal_I2CAdapter lcdAdapter(&lcd, 16, 2);
LcdMenu menu(lcdAdapter);
KeyboardAdapter keyboard(&menu, &Serial);
void setup() {
Serial.begin(9600);
lcdAdapter.begin();
menu.setScreen(mainScreen);
}
void loop() {
keyboard.observe();
}
This example creates a simple menu with four items and displays it on a 16x2 LCD screen. The menu is controlled using the serial monitor, where you can navigate through the items using the arrow keys.
For detailed information on how to use LcdMenu, check out the official docs
Have a question/doubt? Check the Discussions tab, maybe your question has already been answered 😉