and1234577 發表於 2017-3-30 22:48:18

2.4”TFT LCD的SD Card讀取問題

想請問一下,我把2.4”TFT LCD 插在Arduino MEGA 2560G上,寫入測試程式,但測不到SD Card。可是同樣的方法在uno上就可以,求解?
以下是程式碼
#include <SPI.h>
#include <SD.h>

Sd2Card card;
SdVolume volume;
SdFile root;

const int chipSelect = 10;

void setup() {
Serial.begin(9600);
while (!Serial) {
}


Serial.print("\nInitializing SD card...");

if (!card.init(SPI_HALF_SPEED, chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card inserted?");
    Serial.println("* is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");
    return;
} else {
    Serial.println("Wiring is correct and a card is present.");
}

到這裡就return了

超新手 發表於 2017-3-31 09:50:10

SD Card 是怎麼接的?
Arduino Mega 要接到 50, 51, and 52
其他機種(如UNO)則接 11, 12, and 13

and1234577 發表於 2017-4-7 22:43:30

謝謝拉~我問完後有試成功囉~
頁: [1]
查看完整版本: 2.4”TFT LCD的SD Card讀取問題