Go Down

Topic: Problems with a big array (Read 754 times) previous topic - next topic

Sweeduino

I want to store a int value for each minute the last 24 hours. For this i need a array with 1440 int. This doesnt seem to work. I set up the array and then I use a for-loop to set each value to 0 initially. But the program never starts. How can I use a array of this size?
Mu code in itself is about 8k so there should be room left.

Ideas anyone?

/Sweeduino

westfw

Quote
i need a array with 1440 int.  ...  How can I use a array of this size?

Data arrays are stored in RAM, and there is only 2K bytes of RAM available on a mega328, some of which is used by other variables.  Since each "int" is 2 bytes, your array would require 2880 bytes, and it just isn't there.

If your array were full of constants, you could store it in flash memory (there is 32k of flash), but if it's actually data you need to change within your program, you'll have to do something else.

Sweeduino

Thanks. Now I don't need to figure out what's wrong anymore. I have to find another solution.

/Sweeduino

RoyK

Check for threads here and articles in the playground for interfaciing SDHC cards and/or thumb drives with Arduino.

AWOL

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up