void SDsave(long leftdistance , long frontdistance , char direct) { // make a string for assembling the data to log: String dataString = ""; dataString += String(leftdistance); dataString += ","; dataString += String(frontdistance); dataString += ","; dataString += direct; // read three sensors and append to the string: // open the file. note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("datalog.csv", FILE_WRITE); //可以改成.csv變成excel // if the file is available, write to it: if (dataFile) { dataFile.println(dataString); dataFile.close(); } // if the file isn't open, pop up an error: /* else { ; } */ }