I've seen it many times before, where programs use a program memory alternative to Serial.println("text here"); in applications where more RAM is needed. why is it that the compiler makes that use RAM, though? and how exactly does it use RAM?
for example, if the program has many "quoted" (not variable) strings in it, do these all get stored in RAM is does it load a string into RAM when println is called and then unloads it afterwards, or does it keep the last string loaded until the next string related function is called? I'm guessing the first one, but I want to be a bit sure, since I've seen examples that actually copy it from PROGMEM to a global array with a set size, which would just make things worse.
why is it that the compiler makes that use RAM, though?
The characters have to be stored somewhere. By default that is in SRAM.
for example, if the program has many "quoted" (not variable) strings in it, do these all get stored in RAM is does it load a string into RAM when println is called
No. The strings are stored in SRAM when the sketch starts.
and then unloads it afterwards
No. The string stay in SRAM.
but I want to be a bit sure, since I've seen examples that actually copy it from PROGMEM to a global array with a set size, which would just make things worse.
for every single string in the program? I wonder how my program hasn't run out of memory yet, I have stings all over the place, a few arrays and the SD card library in use, and yet it still runs fine.
if I try to use the F("stringHere") from the sticky in a function, I get this problem:
"cannot convert 'const __FlashStringHelper*' to 'char*' for argument '2' to 'void myFunction..."
so what would be the most effective and easy way to get all my functions to use PROGMEM strings instead?
I'm going to do a quick memory test to see if this is really what happens.
EDIT: sadly, it's true, no matter where the string is. surely the compiler should be able to automatically optimize this or something...
and was already in use in my program as a general purpose text holder that holds data for short/very short periods of time (for example, as an alternative to returning a delay). It works, thanks!