Simple Input

This is a basic example, it will show you how to use ItemInput type.

ItemInput has two constructors, one with an initial value of text and the other without. When creating an ItemInput, you must provide a callback function which will be executed when the user exits editing mode (the current value of the ItemInput is passed through to this function).


// other includes ...
#include <ItemInput.h>
#include <LcdMenu.h> // Always comes after every item type import


ItemInput(const char* text, char* value, fptrStr callback)
ItemInput(const char* text, fptrStr callback)
  • text: The text to display for the item.

  • value: The initial value for the input.

  • callback: A reference to the callback function to be invoked when exiting edit mode

Create ItemInput item

    // ...
    ITEM_INPUT("Test", ), 
    /// ...

Type a character

Use menu.type(char character) to type a character

else  // Type the character you want

Run when the menu leaves edit mode example

// ../../examples/SimpleInput/SimpleInput.ino#L80-L83

void inputCallback(String value) {
    Serial.print(F("# "));

Full example 👉 .../examples/SimpleInput/SimpleInput.ino

Last updated