1#include <ItemInputCharset.h>
2#include <LcdMenu.h>
3#include <MenuScreen.h>
4#include <display/LiquidCrystal_I2CAdapter.h>
5#include <input/KeyboardAdapter.h>
6#include <renderer/CharacterDisplayRenderer.h>
7
8#define LCD_ROWS 2
9#define LCD_COLS 16
10
11// Create your charset
12const char* charset = "0123456789";
13
14// Declare the call back function
15void inputCallback(char* value);
16
17// clang-format off
18MENU_SCREEN(mainScreen, mainItems,
19 ITEM_INPUT_CHARSET("Con", "0123456", charset, inputCallback),
20 ITEM_BASIC("Connect to WiFi"),
21 ITEM_BASIC("Blink SOS"),
22 ITEM_BASIC("Blink random"));
23// clang-format on
24
25LiquidCrystal_I2C lcd(0x27, LCD_COLS, LCD_ROWS);
26CharacterDisplayRenderer renderer(new LiquidCrystal_I2CAdapter(&lcd), LCD_COLS, LCD_ROWS);
27LcdMenu menu(renderer);
28KeyboardAdapter keyboard(&menu, &Serial);
29
30void setup() {
31 Serial.begin(9600);
32 renderer.begin();
33 menu.setScreen(mainScreen);
34}
35
36void loop() {
37 keyboard.observe();
38}
39/**
40 * Define callback
41 */
42void inputCallback(char* value) {
43 // Do stuff with value
44 Serial.print(F("# "));
45 Serial.println(value);
46}