New to Arduino and was looking at how to combine a string variable and static text in e.g. a serial.println command.
E.g.
char * name = "My Name"
serial.print(f(name + "static text"))
(but that fails)
New to Arduino and was looking at how to combine a string variable and static text in e.g. a serial.println command.
E.g.
char * name = "My Name"
serial.print(f(name + "static text"))
(but that fails)
Akubra:
serial.print(f(name + "static text"))
The F() macro attempts to put string constants int FLASH (read-only) memory. You can only use it with string constants.
I think you might get the expected output with:
String name = "My Name";
Serial.print(name + "static text");
If you want to get the same effect while saving SRAM:
char *name = "My Name";
Serial.print(name); // Display the name from SRAM...
Serial.print(F("static text")); // ...followed by the label from FLASH.