I get the following compile message: Warning: Large amount of SRAM memory used. Consider using PROGMEM or F("text") macro to reduce ram usage. I only use one small int array (int x[2]).
What is PROGMEM or F("text") macro and how do I use in my sketch?
Any suggestions on reducing memory in my sketch?
Binary sketch size: 21,150 bytes (of a 32,256 byte maximum)
Estimated used SRAM memory: 1,464 bytes (of a 2048 byte maximum)
I can't insert my code because "The message will exceed the maximum allowed length (9500 characters)".
warren631:
Not many fixed strings but I can delete them. Attached is my sketch:
A quick scan through didn't reveal an excessive amount of global data, but you have several dozen string literals which could add up to a few hundred bytes - in this environment, that's a lot.
Version 1.0 of the Arduino IDE introduced the F() syntax for storing strings in flash memory rather than RAM. e.g.
Serial.println(F("This string will be stored in flash memory"));
Another thing to consider is how much SRAM those libraries are consuming.
Finally, I notice that currentMillis is never used, although you assign to it. I'm not sure if the compiler is smart enough to drop the declaration. Do you perhaps have others that are (currently) unused?
warren631:
I get the following compile message: Warning: Large amount of SRAM memory used. Consider using PROGMEM or F("text") macro to reduce ram usage. I only use one small int array (int x[2]).
You don't just count arrays. I counted about 32x int, 10x float, 8x unsigned long. That's 136 bytes already. Plus as others said, the libraries would use RAM as well.
warren631:
Binary sketch size: 21,150 bytes (of a 32,256 byte maximum)
Estimated used SRAM memory: 1,464 bytes (of a 2048 byte maximum)
Things aren't desperate yet. You have 500 bytes in hand.
warren631:
Not many fixed strings but I can delete them. Attached is my sketch:
The warning message from the IDE very helpfully told you the first thing you needed to do, i.e. use the F() macro for all those string literals you pass to Serial.print() and Serial.println(). Looking at your code, I see that you have ignored that advice. Why are you asking for help here instead? If you don't understand what the message is suggesting, and can't understand it after doing some research, you should say so.