- Program logic has to fit within the Arduino's flash memory which static (burned when you sketch is uploaded)
- There is EEProm memory available for sketches to use to store things that are needed across sessions. This is in very short supply but in a microcontroller environment how much should you need anyway?
- Most importantly, however, is the random access memory, or RAM, needed for a program during it's execution. This is in relatively short supply especially if you have any desire to use arrays.
(1 Kbyte used
|16 KBytes||32 KBytes||128 KBytes||256 KBytes|
|SRAM||1024 bytes||2048 bytes||8 KBytes||8 KBytes|
|EEPROM||512 bytes||1024 bytes||4 KBytes||4 KBytes|
My development environment is an Uno (ATMega168) so it is pretty constrained. In a test case a sketch with two integer arrays (a voltage reading and a matching time stamp) maxed out at 400 entries. On my ATmega1280 that is driving the 'Bot the top limit was 1400 entries. I have a Gert Board on order and it uses the one in between (ATMega328).
This was not a realistic case as any reasonably complicated program is going to use more RAM than my example. There are ways of maximizing RAM. One is simply to be cautious with everything and especially with buffers that can be reused and character strings that can be abbreviated. Static information can also be stored in program memory using PROGMEM (here is an example).
One last comment on the Arduino and Memory. How did I first realize that I was having problems with memory management??? Sketches either did not run at all or when they ran they were corrupted and doing REALLY weird things. Drove me a little bit banana's.