Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 2062|回復: 2

2.4”TFT LCD的SD Card讀取問題

[複製鏈接]
發表於 2017-3-30 22:48:18 | 顯示全部樓層 |閱讀模式
想請問一下,我把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
 樓主| 發表於 2017-4-7 22:43:30 | 顯示全部樓層
謝謝拉~我問完後有試成功囉~
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-3-28 19:27 , Processed in 0.181403 second(s), 6 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表