Allora, mi è arrivato il display LCD da 20x4 WOW ! bellisimo ! ... e ho potuto progredire nel progetto.
Ecco cosa ho combinato:
//------ Sega Squadratrice ---------
s1=menu.addMenu(MW_SUBMENU,r,F("SAW")); //add a submenu node 2 to the root menu (control the heigh of my Planner)
s2=menu.addMenu(MW_SUBMENU,s1,F("Altezza Sega")); //add a terminal node in the menu tree (that is "variable"); (should move at a certain mm height)
s3=menu.addMenu(MW_VAR,s2,F("Altezza Assoluta"));
s3->addVar(MW_AUTO_INT,&Height2,0,100,1); //int type, fd binded variable, rage 0-100, step 1
s3=menu.addMenu(MW_VAR,s2,F("moveMOTOR2"));
s3->addVar(MW_ACTION,moveMOTOR2);
s2=menu.addMenu(MW_SUBMENU,s1,F("Spostamento Sega")); //add a terminal node in the menu tree (that is "variable"); (should move at a certain mm height)
s3=menu.addMenu(MW_VAR,s2,F("Movimento Relativo"));
s3->addVar(MW_AUTO_INT,&Height1,-100,100,1); //int type, fd binded variable, rage 0-100, step 1
s3=menu.addMenu(MW_VAR,s2,F("moveMOTOR"));
s3->addVar(MW_ACTION,moveMOTOR);
s2=menu.addMenu(MW_VAR,s1,F("Zero")); //add a terminal node in the menu tree (that is "variable"); (should set the zero)
s2=menu.addMenu(MW_VAR,s1,F("Setup")); //add a terminal node in the menu tree (that is "variable"); (set the parameters)
//------- Pialla --------
s1=menu.addMenu(MW_SUBMENU,r,F("PLANNER")); //add a submenu node 2 to the root menu (control the heigh of my Planner)
//------- Toupie --------
s1=menu.addMenu(MW_SUBMENU,r,F("Toupie")); //add a submenu node 2 to the root menu (control the heigh of my Planner)
E queste sono le funzioni (provvisorie) chiamate:
void moveMOTOR(){
stepper1.moveTo(Height1 * 50); // move Height1 mm's
lcd.print ("Sposto di ");
lcd.print (Height1);
lcd.print (" mm");
delay (5000);
}
void moveMOTOR2(){
stepper1.moveTo(Height2 * 50); // move Height1 mm's
lcd.print ("Altezza Segaa: mm ");
lcd.print (Height2);
delay (5000);
}
In pratica ora il menu fa esattamente quello che volevo (bhè è da finire un poco e da mettere in ordine)
Però ora le funzioni vengono chiamate internamente al ramo scelto, ovvero:
Menu Principale.
SAW > Altezza Sega > Altezza Assoluta > Variabile 0 (X) 100
Esecuzione
Spostamento sega > Movimento Relativo > Variabile -100 (X) +100
Esecuzione
E oltretutto riesco anche a far vedere ciò che succede dul display:
lcd.print ("Sposto di ");
lcd.print (Height1);
lcd.print (" mm");
ovvero mi appare sul LCD "Sposto di X mm""
Fantastico !
Grazie !
Penso che con il menù ho quasi fatto ... ora devo lavorare sul motore passo passo e le relative funzioni.
Ciao
P.S. allego lo sketch completo.
Automazione_Falegnameria_02.ino (10.3 KB)