menu.runMenu
DESCRIPTION
Usually placed in the Loop(). It checks for button and rotary changes. Displays the Menu on LCD.
SYNTAX
menu.runMenu();
PARAMETERS
None.
RETURNS
none.
EXAMPLE #1.
#include
#include
InvIoT_U1 lcd(A0,A1); aIoTMenu menu; //Create menu type aIoTMenu void VOID(){} MENU menuOptions[]={ //All the items in array start with 0. First byte declares the Menu Group. Menu Group 0 is the root menu. {0,"Menu With SubMenus",'t',VOID,0}, // Title of this Menu. Declare with the 't'. Printed on top of LCD. {0,"Print Hello ",'f',helloWorld,0}, // run 'helloWorld' function. Its a 'f' type. Your 1st choice in the menu. Retrun to Root Menu (0) when exit 'helloWorld' function. {0,"Print test ",'f',printTest,0}, // run 'turnLedRed' function. Its a 'f' type. Your 2nd choice in the menu. Retrun to Root Menu (0) when exit 'turnLedRed' function. {255,"",' ',VOID,0}, //End of Menu. }; //********************* SETUP and LOOP ************** void setup() { menu.menu=menuOptions; //Set menuOptions array to menu menu.init(')',sizeof(menuOptions),lcd); //Initialize menu. Character to use for cursor is '>'. Everything is send to lcd } void loop() { menu.runMenu(); // in the loop run menu all the time. It checks for rotary or button action. } //********************* MENU FUNCTIONS ************** void helloWorld(){ lcd.clear(); lcd.print("Hello Menu"); delay(2000); } void printTest(){ lcd.clear(); lcd.print("test"); delay(2000); }