You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// while (!Serial) {
// ; // wait for serial port to connect. Needed for Leonardo only
// }
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
This code does not:
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(10, OUTPUT);
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
The text was updated successfully, but these errors were encountered:
Hi @ShakeyJake , the issue you are reporting is well known and it means that you are using an older version of the library.
The bug has been fixed with #2974. Updating the AVR core using the Board Manager will solve the issue.
By the way, if you open the bundled SD examples (from inside the menu) instead than website Reference (which is always in sync with master branch) digitalWrite(10, HIGH); should be there
The example code here: https://www.arduino.cc/en/Tutorial/Files needs pin 10 set high before you call SD.begin(4) or else initialization fails.
This code works:
// while (!Serial) {
// ; // wait for serial port to connect. Needed for Leonardo only
// }
pinMode(10, OUTPUT);
digitalWrite(10, HIGH);
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
This code does not:
Serial.print("Initializing SD card...");
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
// Note that even if it's not used as the CS pin, the hardware SS pin
// (10 on most Arduino boards, 53 on the Mega) must be left as an output
// or the SD library functions will not work.
pinMode(10, OUTPUT);
if (!SD.begin(4)) {
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
The text was updated successfully, but these errors were encountered: