2014-12-03 51 views
0

我想讀取和寫入數據到SD卡,但在代碼beginnig我採取錯誤卡失敗或不提出。我改變了從示例代碼寫入Arduino的烏諾但仍給了相同的error.I正在使用的Arduino巨型2560.How我能解決這個問題,我的代碼是在這裏:卡失敗或沒有出現Arduino兆豐

#include <SD.h> 

// On the Ethernet Shield, CS is pin 4. Note that even if it's not 
// used as the CS pin, the hardware CS pin (10 on most Arduino boards, 
// 53 on the Mega) must be left as an output or the SD library 
// functions will not work. 
const int chipSelect = 53; 

void setup() 
{ 
Serial.begin(9600); 
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(53, OUTPUT); 

// see if the card is present and can be initialized: 
if (!SD.begin(chipSelect)) { 
Serial.println("Card failed, or not present"); 
// don't do anything more: 
return; 
} 
Serial.println("card initialized."); 
} 

void loop() 
{ 

} 

回答

0

請補充一點:

digitalWrite(53, HIGH); 

如果它是低, Wiznet芯片破壞了SPI總線。 (More details)

相關問題