I have written a function that will take the text file name into a file dump function. I plan to plug into serial and use something like hyperterminal to drop it into a file on my laptop
//dump files from serial connection when appropriate number recieved
if (Serial.available() == 1) {
DataDump("SETTINGS.txt");
} else if (Serial.available() == 2) {
DataDump("TEMPLOG.txt");
} else if (Serial.available() == 3) {
DataDump("TIMELOG.txt");
}
void DataDump(String FileName) { //files available ; TempLog; TimeLog; Settings;
File DumpFile = SD.open(FileName);
if (DumpFile) {
while (DumpFile.available()) {
Serial.print(DumpFile.read());
}
DumpFile.close();
}
else {
Serial.println("Dump file error.........");
}
}// eg DumpFile(TEMPLOG.txt) , DumpFile(TIMELOG.txt) , DumpFile(SETTINGS.txt)
I havent tested this yet but my concern is that in the File DumpFile = SD.open(FileName); in the function the FileName wont have be surrounded by “”. So it wont in fact be the text files name but rather a variable???
Can any one see why this wouldnt work and if this is actually possible??
Thanks