Robofun 機器人論壇

標題: 2.4”TFT LCD的SD Card讀取問題 [打印本頁]

作者: and1234577    時間: 2017-3-30 22:48
標題: 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
SD Card 是怎麼接的?
Arduino Mega 要接到 50, 51, and 52  
其他機種(如UNO)則接 11, 12, and 13
作者: and1234577    時間: 2017-4-7 22:43
謝謝拉~我問完後有試成功囉~




歡迎光臨 Robofun 機器人論壇 (https://robofun.net/forum/) Powered by Discuz! X3.2