I want to store strings in flash, to free up RAM, and I need to read them a character at a time. Here's a demo program:
void pfstring (PGM_P s) {
intptr_t p = (intptr_t)s;
while (1) {
char c = pgm_read_byte(p++);
if (c == 0) return;
Serial.print(c);
}
}
void Test () {
pfstring(PSTR("Printed from Test"));
}
void setup() {
Serial.begin(9600);
Serial.println();
Test();
}
This gives errors when I try and compile - help much appreciated.
Thanks, David