I have to log some data, and I want to do it, as everybody, as fast as possible. Although I'm using a Mega, the ammount of RAM available is pretty limited. I use a SD card through the ethernet shield.
I'm looking for a fast efficient way of writting to a SD card. Right now, opening a file, writting something short and closing gives me around 350 writes in 5 seconds. If I leave the file opened, I can reach 2500 writes in the same 5 seconds, which is pretty good, but I bet I can do it better.
I've read posts about filling a buffer and writting a huge block at a time, reducing the SD accesses. The problem I find is that I really don't know how to write an entire array to the SD card. SD.write() seems to only work with strings or arrays of bytes, and using a for loop leaves me in the same position, with as many accesses to the sd card as positions has the array. It has to be a way to write an array of whatever data you like to the SD without having to loop through it, isn't it? I've been looking for a solution for this problem on and off for a couple of weeks, but I'm unable to find a solution.