There have been other posts in the past about opening multiple (>2?) SD files but I havn't found an answer.
I'm finding that I can't open more than 2 files even after closing 2 ? Is there something missing I have to do or is this a limitation of the SD library ?, are there any other SD library options ?
#include <SD.h>
#include <SPI.h>
void setup(){
File testFile1;
File testFile2;
File testFile3;
File testFile4;
Serial.begin(9600);
Serial.print("Initializing SD card...");
if (!SD.begin(4)) {
Serial.println(" failed!");
while(true);
}
Serial.println(" done");
testFile1 = SD.open("test1.txt");
if (!testFile1) Serial.println("error opening test1");
else Serial.println("test1 open");
testFile1.close();
Serial.println("test1 closed");
testFile2 = SD.open("test2.txt");
if (!testFile2) Serial.println("error opening test2");
else Serial.println("test2 open");
testFile2.close();
Serial.println("test2 closed");
testFile2 = SD.open("test3.txt");
if (!testFile3) Serial.println("error opening test3");
else Serial.println("test3 open");
testFile2 = SD.open("test4.txt");
if (!testFile4) Serial.println("error opening test4");
else Serial.println("test4 open");
while(true);
}
void loop(){
}