Memory with Arduino Nano (w/ ATmega328)

I am using the Arduino Nano, and I am trying to allocate a lookup array of unsigned chars 50x50.

unsigned char swing_array[50][50] = { {0, 10, 11, 10, ...

When I do this, the program never even reaches the setup() function. In fact, the L ("Load") LED stays lit, whereas usually it blinks upon reset.

However, when I reduce the size of the array to, say, 200 elements. I do not have this problem. I feel like the large array size is proving to have issues. The program compiles and uploads just fine, but when I try to run it, that is where I run into the problem. I made the setup() function print out a message (after Serial.begin) once the function began, and then once the setup() function concludes. Neither of these messages are ever being displayed.

Is there a way to do dynamic memory allocation with the Arduino? I am still only using 18K of the 30K limit, so how do I store this array without having this happen?

50 x 50 = 2500, about 2.4K. Your Nano's CPU only has 2K of RAM. By default variables are kept in RAM because there's no way for the system to know you won't be changing those values.

If the lookup array will never change look up PROGMEM and it will show you how to keep that data in flash, instead of RAM.

Good luck!

Thank you so much. That was a relatively quick reply too! That is exactly what I needed to do. Now it runs and loads perfectly.

-Dubble M