I was using a microSD card reader/writer and found a really weird behavior, using this code (library is the SD library co-developed by SparkFun, v1.2.4).
#include <SD.h>
#include <SPI.h>
File datasheet;
void setup() {
Serial.begin(115200);
Serial.println("Intializing SD Card...");
if(!SD.begin(4))
{
Serial.println("SD Card initialization failed.");
return;
}
Serial.println("SD Card intialization successful.");
Serial.println("Creating files...");
datasheet = SD.open("testlog.txt", FILE_WRITE);
datasheet.close();
datasheet = SD.open("datasheet.txt", FILE_WRITE);
datasheet.close();
Serial.println("Files found / created.");
}
void loop() {
}
This code creates a file named "TESTLOG.txt", as expected, but do not create a file named "DATASHEET.txt".
However, if I change, and change only that, "datasheet.txt" into anything else, such as "datashet.txt", it now does create a file named "DATASHET.txt".
So effectively, having datasheet = SD.open("datashet.txt", FILE_WRITE); works but not datasheet = SD.open("datasheet.txt", FILE_WRITE);... nothing else but the name changed, how can that change anything ?
Can anyone else reproduce it with any other microSD modules or is it just a weird behavior/bug of mine ?