To use the LcdMenu library in your project, follow these steps:

1. Include the LcdMenu library in your sketch

#include <LcdMenu.h>

You will need to add other includes for the types of menu items you wish to use, the available types are described in the next step.

#include LcdMenu.h should always be the last include statement after all menu-item type imports

2. Create the main menu, using the provided macro MAIN_MENU() e.g.

  ITEM_INPUT("Connect", resultCallback),
  ITEM_COMMAND("Backlight", toggleBacklight),
  ITEM_TOGGLE("Toggle", "ON", "OFF", toggleStuff)

Replace the sample menu items with your own menu items. Here are the different types of menu items available:



a basic menu item with no functionality



a menu item that executes a function when selected



a menu item that toggles a value when selected



a menu item that prompts the user to enter a value



a menu item that leads to a sub-menu when selected



a menu item that displays a value that is chosen form a list of strings



a menu item that displays a mappable progress value from 0 to 1000.


For each menu item, specify the menu item text, and any necessary parameters. For example, in ITEM_COMMAND("Backlight", toggleBacklight), "Backlight" is the menu item text and toggleBacklight is the function to be executed when the item is selected.

3. Once you have created your menu, initialize LcdMenu with the menu items in the setup()

menu.setupLcdWithMenu(0x27, mainMenu); //I2C
// or
menu.setupLcdWithMenu(rs, en, d0, d1, d2, d3, mainMenu); // Standard

4. In the loop() function, define how you want to navigate the menu

You can use any input method of your choice to perform actions on the menu

Last updated