What I have tried so far:
1. I have a very simple test sketch that repeatedly opens, writes to and closes a test file; that works fine, so probably not a hardware or wiring issue or issue with the SD card itself.
2. I have tons of free memory (4K), so memory or memory not a memory leak.
3. I have tried using a static filename and static text, so not related to the name of the file or what I am actually writing to the file.
4. I have tried turning off the GPS interrupt before open the SD file and turning back on after the write is complete.
The full sketch is attached, and the key code is below:
Code: Select all
File positionLog;
positionLog = SD.open(positionFileName, FILE_WRITE);
if (positionLog) // was open was successful?
{
positionLog.println(myString); // write it to the file
positionLog.close();
Serial.println(myString);
}
else
{
Serial.println(F("SD CARD ERROR"));
}