boolean SDClass::begin(uint8_t csPin) {
/*
Performs the initialisation required by the sdfatlib library.
Return true if initialization succeeds, false otherwise.
*/
boolean pass1, pass2, pass3;
pass1 = card.init(SPI_HALF_SPEED, csPin);
pass2 = volume.init(card);
pass3 = root.openRoot(volume);
Serial.print("inizializzazione SD 1:");
Serial.println(pass1, BIN);
if (!pass1){
Serial.print("ERRORE inizializzazione SD 1:");
Serial.print( card.errorCode() );
Serial.print( " " );
Serial.println( card.errorData() );
}
Serial.print("inizializzazione SD 2:");
Serial.println(pass2, BIN);
if ( !pass2 ){
Serial.println("Errore init 2:\nThe value one, true, is returned for success and the value zero, false, is returned for failure. Reasons for failure include not finding a valid partition, not finding a valid FAT file system in the specified partition or an I/O error.");
}
Serial.print("inizializzazione SD 3:");
Serial.println(pass3, BIN);
if (!pass3){
Serial.println("Errore init 3:\nReasons for failure include \a fileName contains an invalid DOS 8.3 file name, the FAT volume has not been initialized, a file is already open, the file already exists, the root directory is full or an I/O error.");
}
return pass1 &&
pass2 &&
pass3;
}
prova con questo codice, cosa ti dice?