Hello all,
Using a: SparkFun microSD Shield - DEV-12761 - SparkFun Electronics
With: Google Code Archive - Long-term storage for Google Code Project Hosting.
on an Uno Rev3.
I'm doing some data logging out to a file on the sd card fine but part of it is making me twitchy.
void loop()
{
if (!sd.begin(chipSelect, SPI_FULL_SPEED)) sd.initErrorHalt();
ofstream sdout("test.csv", ios::out | ios::app);
//Do logging to sdout here
//eg sdout << "test" << flush
sdout.close();
}
Is there anyway to keep the file handle open between loops? This works fine I'm just concerned that this sort of behaviour seems inefficient/detrimental to the sd card.
I've tried declaring some of the stuff in setup()/ the main file body but this does not work, the examples with the library seem to agree that this is the only way to write to a file within loop()
Thanks