-
I have a callbackfunction that calls another subfunction like this: void myCallbackFunction()
{
menu.lcd.clear();
vref=(analogRead(Vref));
calcVoltage(); **// this is the calling function**
while (1)
{
/****************exit code************ */
Return_Button.read(); // get out of loo
if (Return_Button.wasReleased())
{
Serial.println("Break");
break;
}
}
} Below is the code in another file called "subs.h placed in the folder "include" #include <header.h>
void calcVoltage()
//(uint16_t vref)
{
Serial.println("i was here");
//vref = analogRead(Vref);
uint16_t voltValue = ((vref * 3.3) / 4095);
Serial.print("ADC Value = ");
Serial.print(vref);
//delay(1000);
Serial.print(" ");
Serial.print("Voltage = ");
Serial.print(voltValue);
Serial.println(" V");
} the problem is now that the compiler says ok (no problems) but the compilations stops with a message as follows: Another question: is it possible to nest a SUB_MENU in a SUBMENU?? kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's always best to declare all your functions before you define them. See this So please declare all the functions before void myCallbackFunction();
void calcVoltage();
MAIN_MENU(
// ...
)
// ...
void myCallbackFunction() {
// ...
}
void calcVoltage() {
// ...
}
Yes it is possible. Example: extern MenuItem* settingsMenu[];
extern MenuItem* subSettingsMenu[];
MAIN_MENU(
ITEM_BASIC("Placeholder 1"),
ITEM_SUBMENU("Settings", settingsMenu));
SUB_MENU(
settingsMenu,
mainMenu, // Parent menu
ITEM_SUBMENU("Sub settings menu", subSettingsMenu),
ITEM_BASIC("Placeholder 2"));
SUB_MENU(
subSettingsMenu,
settingsMenu, // Parent menu
ITEM_BASIC("Backlight"),
ITEM_BASIC("Contrast")); |
Beta Was this translation helpful? Give feedback.
It's always best to declare all your functions before you define them. See this
So please declare all the functions before
MAIN_MENU
as such:Yes it is possible.
Example: