Pages: [1]   Go Down
Author Topic: Problems with a big array  (Read 698 times)
0 Members and 1 Guest are viewing this topic.
Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 137
Posts: 6792
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Sweden
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

/Sweeduino
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 329
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26527
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Or I2C EEPROM devices
Logged

"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.

Pages: [1]   Go Up
Jump to: