i'm using a Mega 2560. My Sketch is as big as 101.078 Bytes and the Mega does not run the program, although it is uploaded correctly. There are some pictures in form of extern c. files inside the sketch. When i remove one of them so that my sketch is around 90.000 Bytes everythink works fine. But why? I thought i have 258.048 Bytes of space?
Maybe you don't have enough RAM. Try to put this function before and after you load your picture. It shows the remaining number of bytes of RAM.
int free_ram(){ //return byte of free ram, usefull to debug
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
To use it do this :
Serial.println(free_ram());
Make shure you have started Serial port with
Serial.begin(9600)
or whatever baudrate you want.
If you use a lot of Serial.print("string") or lcd.print("string"), you can use the F() macro to store the strings you want to display in the flash instead of the ram. This macro only work with strings, if you want to store other types of data in the flash, use progmem.