Serial.print("\nInitializing SD card..."); | Serial.print("\nInitializing 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); // change this to 53 on a mega | |||||
// we'll use the initialization code from the utility libraries | // we'll use the initialization code from the utility libraries |
Serial.print("Initializing SD card..."); | Serial.print("Initializing SD card..."); | ||||
// make sure that the default chip select pin is set to | |||||
// output, even if you don't use it: | |||||
pinMode(10, OUTPUT); | |||||
// see if the card is present and can be initialized: | // see if the card is present and can be initialized: | ||||
if (!SD.begin(chipSelect)) { | if (!SD.begin(chipSelect)) { |
Serial.print("Initializing SD card..."); | Serial.print("Initializing SD card..."); | ||||
// make sure that the default chip select pin is set to | |||||
// output, even if you don't use it: | |||||
pinMode(10, OUTPUT); | |||||
// see if the card is present and can be initialized: | // see if the card is present and can be initialized: | ||||
if (!SD.begin(chipSelect)) { | if (!SD.begin(chipSelect)) { |
Serial.print("Initializing SD card..."); | 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(chipSelect)) { | if (!SD.begin(chipSelect)) { | ||||
Serial.println("initialization failed!"); | Serial.println("initialization failed!"); |
Serial.print("Initializing SD card..."); | 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(chipSelect)) { | if (!SD.begin(chipSelect)) { | ||||
Serial.println("initialization failed!"); | Serial.println("initialization failed!"); | ||||
return; | return; |
Serial.print("Initializing SD card..."); | 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(chipSelect)) { | if (!SD.begin(chipSelect)) { | ||||
Serial.println("initialization failed!"); | Serial.println("initialization failed!"); |