void writeAllData() { String tempStuff = String(myID) + ".scn"; Serial.println(tempStuff); myFile = SD.open(tempStuff.c_str(), FILE_WRITE); if (myFile) { myFile.println("Jimmie"); myFile.println(" "); myFile.println(" "); for (int SN = 0; SN < 3; SN++) { myFile.println(" "); myFile.println("================================================================================="); myFile.println("Sensor " + String(SN)); myFile.println("================================================================================="); for (int j = 1; j <= scan[SN] - 1; j++) { myFile.println(" "); tempStuff = "Scan: " + String(j) ; myFile.println(tempStuff.c_str()); for (int k = 0; k < 16; k++) { tempStuff = String(k) + "," + String(BUFFER[SN][j][k][0]) + "," + String(BUFFER[SN][j][k][1]); myFile.println(tempStuff.c_str()); //Serial.println("Sensor Number = " + String(SN) + " Scan = " + String(j) + " Segment = " + String(k)); } } } myFile.close(); Serial.println(">>> SD File Closed"); } else { Serial.println("ERROR: Cannot open SD File!"); } } void write2SD() { myFile = SD.open("test.txt", FILE_WRITE); // if the file opened okay, write to it: if (myFile) { Serial.print("Writing to test.txt..."); myFile.println("testing 1, 2, 3."); // close the file: myFile.close(); Serial.println("done."); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } } void readSD() { // re-open the file for reading: myFile = SD.open("test.txt"); if (myFile) { Serial.println("test.txt:"); // read from the file until there's nothing else in it: while (myFile.available()) { Serial.write(myFile.read()); } // close the file: myFile.close(); } else { // if the file didn't open, print an error: Serial.println("error opening test.txt"); } }