SRAM PREDICTION

Hello,

Sketch uses 15,360 bytes (47%) of program storage space. Maximum is 32,256 bytes.
Global variables use 1,325 bytes (64%) of dynamic memory, leaving 723 bytes for local variables. Maximum is 2,048 bytes.

my code showing this:
Is this means my SRAM uses 64%. can i use SRAM above 90% or fully to run code without error?

You can use almost all of the RAM, be aware that calling functions uses RAM (for the return address) and local variables use RAM (for the variable). Also interrupts will require some RAM (eg. timer interrupts).

Ok sir thank you.
actualy i'm using all.
what abt global variable?

ankushg989:
Hello,

Sketch uses 15,360 bytes (47%) of program storage space. Maximum is 32,256 bytes.

Global variables use 1,325 bytes (64%) of dynamic memory, leaving 723 bytes for local variables. Maximum is 2,048 bytes.




my code showing this:
Is this means my SRAM uses 64%. can i use SRAM above 90% or fully to run code without error?

How about trying this: Arduino Playground - HomePage

This little library function returns the amount of free SRAM your program has available to it. Temporarily print out your free ram at key places in your program and see what you have left. That will give you confidence in knowing that you have enough (or maybe DON'T have enough) ram free.

Once you're satisfied, you can remove the function and debug code.

The Arduino's lack of a debugger means sprinkling Serial.print()'s in the code until things get stable. My experience is that "stable" lasts until the next time I edit the source code. Because of that, I use scaffold code for debugging. For example:

#define DEBUG                      // The very first line in the source file

// a bunch of lines...

void setup() 
{
#ifdef DEBUG
   Serial.begin(115200);
#endif

//   more code....

#ifdef DEBUG
   Serial.print("In myFunction()...");
   Serial.println(freeMemory());
#endif

// ...and so on...

When I think I have things stabilized, I just comment out the #define DEBUG line at the top and all of the print statements are removed from the compiled code. However, if I need to reinstate them for testing at some later time, just remove the comment characters on that line. If I want to reduce the number of print data being displayed but really don't want to permanently get rid of the debug statements, I'll change that section to read #ifdef DEBUG1. Since DEBUG1 is not defined, those comments disappear, but can be reinstated easily without a bunch of typing.

Finally, when the code is REALLY stable...I still leave the scaffolding code in. While they do add come clutter to the code, I find that, by not indenting the scaffolding code, it doesn't really impinge on the readability of the code.

#ifdef DEBUG
   Serial.print(F("In myFunction()..."));
   Serial.println(freeMemory());
#endif

{cough}

@AWOL: opps...I bow to the Master!

ok sir

econjack:
@AWOL: opps...I bow to the Master!

On the contrary - I don't have a rule named for me!