Read from EEPROM or use print(F)

Hello Everyone,

my main goal is to learn which is the better way to program a more stable program.

Specifically, I have to display a message a couple times on the LCD display ("Today Longest Fish").

Now I have seen people read that stored message from the EEPROM like this:

void(){
 display_fish();
}
void display_fish(){
  for (byte i = 0; i < 19; i++) {
    char a = ((EEPROM.read(980 + i)));
    lcd.print(a);
  }
}

but I've also seen the F macro used. Like this:

void(){
 display_fish();
}
void display_fish(){
 lcd.print(F("Today Longest Fish:"));
}

Which way is better? What would you guys do and if it is not too much to ask, could you tell me why or point me to an article. I really would appreciate it!

Thanks in advance.

It simply depends.

If you ever want to change the text, I would put it in EEPROM (and provide an interface in the Arduino code so it can be changed).

If it is cast in stone, I will put it in PROGMEM (F macro); remember that in that case you have to recompile if it ever needs to change.

Other reason to put it in EEPROM is if you run out of code space.

There is very little EEPROM (1024 bytes?) so you can't fit many messages in it.

The PRIMARY use for EEPROM is to store those bits of data that can change but must be remembered when the power is off. Like if you need to store a WiFi SSID or WiFi password for the next time the Arduino is turned on.

For things that can change but don't need to be remembered: RAM. For those things that don't change: FLASH/PROGMEM

There is far more FLASH/PROGMEM than RAM so variables that don't need to change, like lookup tables and message strings, are often put into FLASH/PROGMEM to preserve RAM space. The F() macro is an easy way to keep string constants used for messages from taking up space in RAM.

If you do decide to use EEPROM then can I suggest that you use the put() and get() functions to save and load the strings with a single command rather than the for loop that you currently use