1#include <ItemInput.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// Declare the call back function
12void inputCallback(char* value);
13
14// clang-format off
15MENU_SCREEN(mainScreen, mainItems,
16 ITEM_INPUT("Con", inputCallback),
17 ITEM_BASIC("Connect to WiFi"),
18 ITEM_BASIC("Blink SOS"),
19 ITEM_BASIC("Blink random"));
20// clang-format on
21
22LiquidCrystal_I2C lcd(0x27, LCD_COLS, LCD_ROWS);
23CharacterDisplayRenderer renderer(new LiquidCrystal_I2CAdapter(&lcd), LCD_COLS, LCD_ROWS);
24LcdMenu menu(renderer);
25KeyboardAdapter keyboard(&menu, &Serial);
26
27void setup() {
28 Serial.begin(9600);
29 renderer.begin();
30 menu.setScreen(mainScreen);
31}
32
33void loop() {
34 keyboard.observe();
35}
36
37/**
38 * Define callback
39 */
40void inputCallback(char* value) {
41 // do something with the input value
42 Serial.println(value);
43}