Thanks to all. I am a 60 year old who is currently auditing CS1 Java at the local College. LOTS to learn, but sometimes all I need is a nudge in the right direction. This is my solution. It works very nicely. Of course later I will go back in and revisit the structure and make changes once I learn more.
void loop() {
if (runOnce == true) {
mainMenu();
runOnce = false;
}
if (Serial.available() > 0 ) {
if (topMenu == 'Q') {
topMenu = Serial.read();
}
if (topMenu == 'a' || topMenu == 'A') {
subMenuA = Serial.read();
}
else if (topMenu == 'b' || topMenu == 'B') {
subMenuB = Serial.read();
}
else if (topMenu == 'c' || topMenu == 'C') {
subMenuC = Serial.read();
}
else if (topMenu == 'd' || topMenu == 'D') {
subMenuD = Serial.read();
}
switch (topMenu) {
case 'A' : case 'a' : {
topCaseA();
switch (subMenuA) {
case '1' : {
subMenuA1();
break;
}
case '2' : {
subMenuA2();
break;
}
case '3' : {
subMenuExit();
break;
}
break;
} /* End subMenu A Switch */
break;
} /* End Case A */
case 'B' : case 'b' : {
topCaseB();
switch (subMenuB) {
case '1' : {
subMenuB1();
break;
}
case '2' : {
subMenuB2();
break;
}
case '3' : {
subMenuB3();
break;
}
case '4' : {
subMenuExit();
break;
}
break;
} /* End subMenu B Switch */
break;
} /* End Case B */
case 'C' : case 'c' : {
topCaseC();
switch (subMenuC) {
case '1' : {
subMenuC1();
break;
}
case '2' : {
subMenuC2();
break;
}
case '3' : {
subMenuExit();
break;
}
break;
} /* End subMenu C Switch */
break;
} /* End Case C */
case 'D' : case 'd' : {
topCaseD();
switch (subMenuD) {
case '1' : {
subMenuD1();
break;
}
case '2' : {
subMenuD2();
break;
}
case '3' : {
subMenuExit();
break;
}
break;
} /* End subMenu D Switch */
break;
} /* End Case D */
default :
if (topMenu != 'a' || topMenu != 'b' || topMenu != 'c' || topMenu != 'd') {
runOnce = true;
if (runOnce == true) {
Serial.println(" Please Choose Options A - D");
runOnce = false;
topMenu = 'Q';
}
}
} /* End topMenu Switch */
} /* End Serial.available */
} /* End Void Loop */
It needs to be highly compartmentalized and each function needs to have its own menu item because the entire purpose is to show the kids how to make structured menu/submenus for whatever purpose using both switch/case and if/else if/else logic then let them improve on the structure. Thanks again!