arduino读取sd卡失败

arduino读取sd卡失败,第1张

arduino读取sd卡失败

1.检查sd卡是否支持arduino,一般情况下只有micro sd卡才能支持arduino;

2.检查sd卡的连接是否正常;

3.检查sd卡的容量是否超过arduino的最大容量,arduino的最大容量一般为2G;

4.检查sd卡是否被格式化为FAT格式;

5.检查arduino是否正确连接sd卡,比如检查sd卡的物理连接是否正确;

6.检查arduino的程序是否正确,比如检查sd卡的初始化程序是否正确;

7.检查sd卡是否被其他设备正确识别,如果其他设备也无法识别,则可能是sd卡本身的问题。

需要安装,Arduino IDE才能够使用。

方法是,点菜单栏的Sketch---》导入库---》添加库

然后找到你要添加的库文件的位置,添加进去。(比如是xxxx.h)

随后,每次你要用xxxx.h的时候

输入:

#include<xxxx.h>就行。

随后,才是调用xxxx.h中的函数。

上面的步骤缺一不可。

PImage logo

 void setup() {

  // initialize the GLCD and show a message

  // asking the user to open the serial line

  tft.begin()

  tft.background(255, 255, 255)

  tft.stroke(0, 0, 255)

  tft.println()

  tft.println("Arduino TFT Bitmap Example")

  tft.stroke(0, 0, 0)

  tft.println("Open serial monitor")

  tft.println("to run the sketch")

  readsd()

  // now that the SD card can be access, try to load the

  // image file.

  logo = TFTscreen.loadImage(myFile)

  if (!logo.isValid()) {

    Serial.println("error while loading arduino.bmp")

  }

}

void loop() {

  // don't do anything if the image wasn't loaded correctly.

  if (logo.isValid() == false) {

    return

  }

  

  Serial.println("drawing image")

  // get a random location where to draw the image.

  // To avoid the image to be draw outside the screen,

  // take into account the image size.

  int x = random(tft.width() - logo.width())

  int y = random(tft.height() - logo.height())

  // draw the image to the screen

  tft.image(logo, x, y)

  // wait a little bit before drawing again

  delay(1500)

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/11296887.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存