Used the sample with simpel menu and modfied it to my needs to get the feel of it all.
80% I have coped and understand.
One thing sofar I ran into as a problem is that not more then 5 menu's are shown when scrolling.
after s2=menu.addMenu(MW_VAR,s1,"Min"); //add a terminal node in the menu tree (that is "variable");
nothing shown and we start at the top again if we scroll.
So it looks my number of menus is declared somewhere as a max of 5 but cant find it.
Paco
//MENWIZ ESAMPLE
//
//Needs 6 buttons.
//Navigation tips:
//- to confirm chanhes allways push confirm button
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>
// DEFINE ARDUINO PINS FOR THE NAVIGATION BUTTONS
#define UP_BOTTON_PIN 9
#define DOWN_BOTTON_PIN 10
#define LEFT_BOTTON_PIN 7
#define RIGHT_BOTTON_PIN 8
#define CONFIRM_BOTTON_PIN 12
#define ESCAPE_BOTTON_PIN 11
//Create global object LCD and MENU
menwiz menu;
LiquidCrystal_I2C lcd(0x27,20,4);
//instantiate global variables to bind to menu
byte tp=2;
int gp=26;
boolean wr=0;
void setup(){
char b[84];
_menu *r,*s1,*s2;
_var *v;
int mem;
Serial.begin(19200);
// inizialize the menu object (20 colums x 4 rows LCD)
menu.begin(&lcd,20,4);
//create the menu tree
r=menu.addMenu(MW_ROOT,NULL,"MAIN MENU"); //create a root menu at first (required)
s1=menu.addMenu(MW_SUBMENU,r,"Settings"); //add a submenu node to the root menu
s2=menu.addMenu(MW_VAR,s1,"SpeedStart"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&gp,1,125,5); //Set value
s2=menu.addMenu(MW_VAR,s1,"SpeedCurve"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&gp,1,125,5); //Set value
s2=menu.addMenu(MW_VAR,s1,"Brake"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&gp,1,125,5); //Set value
s2=menu.addMenu(MW_VAR,s1,"Model"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&gp,1,10,1); //Set value
s2=menu.addMenu(MW_VAR,s1,"Min"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&gp,1,255,1); //Set value
s2=menu.addMenu(MW_VAR,s1,"Max"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_AUTO_INT,&gp,1,255,1); //Set value
s2=menu.addMenu(MW_VAR,s1,"Reset"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_BOOLEAN,&wr); //Set value
s2=menu.addMenu(MW_VAR,s1,"Calibrate"); //add a terminal node in the menu tree (that is "variable");
s2->addVar(MW_BOOLEAN,&wr);
//(optional) create a splash screen (lap 4 seconds) with some usefull infos
//the character # marks end of line
//(tip): use preallocated internal menu.sbuf buffer to save memory space!
sprintf(menu.sbuf,"DIGITAL SLOT WIZARD #Version 1.01#",6);
menu.addSplash((char *) menu.sbuf, 4000);
//declare navigation buttons (required)
// equivalent shorter call: menu.navButtons(9,10,7,8,11,12);
menu.navButtons(UP_BOTTON_PIN,DOWN_BOTTON_PIN,LEFT_BOTTON_PIN,RIGHT_BOTTON_PIN,ESCAPE_BOTTON_PIN,CONFIRM_BOTTON_PIN);
// create a user define screen callback to activate after 5 secs since last button push
menu.addUsrScreen(msc,5000);
//
}
void loop(){
// NAVIGATION MANAGEMENT & DRAWING ON LCD. NOT BLOCKING
menu.draw();
//PUT APPLICATION CODE HERE
}
// user defined default screen
void msc(){
lcd.begin(20, 4);
lcd.setCursor(0,0);
lcd.print("SPD ");
lcd.setCursor(6,0);
lcd.print("123");
//lcd.print(speedValue);
lcd.setCursor(12,0);
lcd.print("MDL ");
lcd.setCursor(17,0);
lcd.print("1");
//lcd.print(speedValue);
lcd.setCursor(0,1);
lcd.print("SPDST");
lcd.setCursor(6,1);
lcd.print("123");
//lcd.print(speedstartValue);
lcd.setCursor(12,1);
lcd.print("MIN");
lcd.setCursor(17,1);
lcd.print("255");
//lcd.print(minValue);
lcd.setCursor(0,2);
lcd.print("SPDC");
lcd.setCursor(6,2);
lcd.print("123");
//lcd.print(speedcurveValue);
lcd.setCursor(12,2);
lcd.print("MAX");
lcd.setCursor(17,2);
lcd.print("0");
//lcd.print(maxValue);
lcd.setCursor(0,3);
lcd.print("BRK");
lcd.setCursor(6,3);
lcd.print("255");
//lcd.print(brakeValue);
lcd.setCursor(12,3);
lcd.print("DBD");
lcd.setCursor(17,3);
lcd.print("15");
//lcd.print(deathbandValue);
}