I want to know if it's possible to use the F() macro on text that is being passed to a function.
This is an example function:
void displayMenu(const char * txt, byte &var) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(txt);
lcd.setCursor(0, 1);
lcd.print(var);
}
This is how I'm calling the function:
displayMenu("Backlight:", backlight);
If I didn't separate the repeating code into a separate function, I would've been able to write it out like this:
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(F("Backlight: "));
lcd.setCursor(0, 1);
lcd.print(var);
If I try to do:
displayMenu(F("Backlight"), backlight);
it doesn't work. Also if I try to do this in the function:
lcd.print(F(txt));
that also doesn't work.
I'm just wondering if such a thing is possible.