diff --git a/src/main.cpp b/src/main.cpp index f358aa1..77ccc86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,14 @@ Joystick joystick; Display display; +Item items[MENU_ITEM_COUNT] = { + {"Feed", []() { Serial.println("Feeding..."); }}, + {"Play", []() { Serial.println("Playing..."); }}, + {"Sleep", []() { Serial.println("Sleeping..."); }}, + {"Clean", []() { Serial.println("Cleaning..."); }} +}; +Menu menu(items); + void setup() { Serial.begin(9600); while (!Serial) { @@ -14,7 +22,19 @@ void setup() { display.begin(); pinMode(LED_BUILTIN, OUTPUT); + display.drawMenu(menu); } void loop() { + JoystickDirection direction = joystick.getDirection(); + if (direction != JoystickDirection::CENTER) { + menu.updateCurrentItem(direction); + display.drawMenu(menu); + } + + if (joystick.isPressed()) { + menu.execute(); + } + + delay(250); }