I have an Arduino Ethernet Shield W5500 Development Board which has a slot for a SD card. I insert a Micro SD card into the slot (FAT32 formatted) and try executing a sketch because Arduino should execute the HTML file on the webserver …
// initialize SD card
Serial.println("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println("ERROR - SD card initialization failed!");
return; // init failed
}
Serial.println("SUCCESS - SD card initialized.");
// check for index.htm file
if (!SD.exists("index.htm")) {
Serial.println("ERROR - Can't find index.htm file!");
return; // can't find index file
The “index.htm” file is there. So I am quite astonished that the serial monitor complains about a missing file.
I have a SD card module at hand and execute a sketch writing some lines in a testfile …
Serial.print("Writing to test.txt…");
myFile.println("This is a test file :)");
myFile.println("testing 1, 2, 3.");
for (int i = 0; i < 20; i++) {
myFile.println(i);
}
// close the file:
myFile.close();
Serial.println("done.");
Now I can see in the serial monitor that there is NO error message that the “index.htm” file is not there. And I am quite surprised that the C++ sketch has written the text into the “index.htm” file and saved it as “INDEX.HTM”.
Seems to be a matter of fact that Arduino, when accessing a Micro SD card (FAT32) , expects the filename in upper cases and ignores filenames with lower case letters.