Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By johnsondavies
#74232 I've read the excellent documentation "Guide to PROGMEM on ESP8266 and Arduino IDE" in the docs, but still can't get my application to work.

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:

Code: Select allvoid 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