Serial.print(F(“Hello World”));

When you compile your program it says how much program memory (stored in flash) you are using and how much dynamic ram you are using.

If you use F() you can move constant strings to the program memory instead of the ram. This will take up space that will decrease the amount of other code you can write. But it will free up dynamic ram.

My chip has 32KB of Flash memory (2Kb taken up by bootloader) and 2KB or RAM. Sometimes I need to store lots of data in RAM so I move the constant strings to Flash memory. Sometimes my program has a lot of steps and I have a shortage of Flash memory so I leave the strings in RAM.

2 Likes