I´ve made a logging code for my Arduino (and copy from others!). Sometimes the logging goes wrong, while writing the data to the SD-card. Sometimes it fails with wierd text (in serial monitor), other times the it freeze in serial monitor.
I think it´s because of overflow in the memory ?
Can I do somthing to get som free memory, when writing to SD card? (examples please?)
using the sd library included in IDE>=1 is very easy to finish the ram.
For knowing the free amount of ram you can use these lines:
int availableMemory() {
int size = 2048; // Use 2048 with ATmega328, 1024 with ATmega 168, 9920 con il 2560
byte *buf;
while ((buf = (byte *) malloc(--size)) == NULL)
;
free(buf);
return size;
}
Serial.println(availableMemory());
Or (better) I suggest you to install the erwin ried enchanged version of arduino ide.
If you need a thinner SD library just look at this page: http://code.google.com/p/arduino-filelogger/
All of your constant strings, where you Serial.print() debug messages, could be kept out of SRAM (which is the kind of memory you are likely to be running out of) by using the F macro.