I'm trying to use a 1.8" ST7735 w/ SD card slot and Arduino UNO to load and display a .bmp file (just one for now). I formatted the 8 GB microSD as MS-DOS FAT. I keep getting this error:
In file included from /private/var/folders/th/yhd_876n1cv3y157bc7312s80000gn/T/AppTranslocation/41E15F2B-DA9E-4CAA-94E4-1210606246BE/d/Arduino.app/Contents/Java/libraries/TFT/src/TFT.h:36:0,
from /Users/.../Documents/Arduino/SD_Disp/SD_Disp.ino:3:
/private/var/folders/th/yhd_876n1cv3y157bc7312s80000gn/T/AppTranslocation/41E15F2B-DA9E-4CAA-94E4-1210606246BE/d/Arduino.app/Contents/Java/libraries/TFT/src/utility/Adafruit_GFX.h: In static member function 'static PImage PImage::loadImage(const char*)':
/private/var/folders/th/yhd_876n1cv3y157bc7312s80000gn/T/AppTranslocation/41E15F2B-DA9E-4CAA-94E4-1210606246BE/d/Arduino.app/Contents/Java/libraries/TFT/src/utility/Adafruit_GFX.h:318:40: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
if ((bmpFile = SD.open(fileName)) == NULL) {
^
and when I run it (since those are warnings), the program is unable to load the image.
Here's the code:
#include <SD.h>
#include <SPI.h>
#include <TFT.h>
#define SD_MOSI 11
#define TFT_SDA 11
#define SD_MISO 12
#define SD_SCK 13
#define TFT_SCK 13
#define SD_CS 4
#define TFT_CS 10
#define TFT_DC 8
#define TFT_RST 9
TFT tft = TFT(TFT_CS, TFT_DC, TFT_RST);
PImage bmp;
void setup() {
Serial.begin(9600);
tft.begin();
tft.background(255,255,255);
if (!SD.begin(SD_CS)) {
Serial.print("failed");
return;
}
bmp = tft.loadImage("Words1.bmp");
if (!bmp.isValid()) {
Serial.println("error while loading image");
}
}
void loop() {
// put your main code here, to run repeatedly:
tft.image(bmp,0,0);
delay(2000);
}
Any help would be appreciated. I've looked at lots of similar discussions and can't seem to find any that help. Lmk if there's any information I've omitted or if a picture of my wiring would help - but I'm pretty sure I've got it wired correctly. There are no issues when I use the display without the SD card to draw text.