I am pretty new to Arduino, Adafruit, and different projects, so I apologize if this is basic or has been asked before.
I am attempting to use a
1.8" Color TFT LCD display with MicroSD Card Breakout - ST7735R
Link Here: https://www.adafruit.com/product/358
with an Arduino Uno Wifi Rev 2
Link Here:
https://store.arduino.cc/products/ardui ... NC4wLjAuMA
I am attempting to follow the examples from Adafruit on how to display bitmaps from a SD Card on this TFT screen. I am using the example code from the Adafruit ImageReader Library called Breakout ST7735 - 160 x 128. However, all I get is a blank white screen.
Here is the tutorial I am following:
https://learn.adafruit.com/1-8-tft-disp ... ng-bitmaps
I have made edits to the code since my goal is to just get an image to appear on the screen. No looping or changing of imagery.
I got the wiring test to work eventually, so I believe my wiring is correct. I did have to make changes to the code to get this to work, so maybe I am missing something on bitmaps from an SD?
Here is the link to the wiring test:
https://learn.adafruit.com/1-8-tft-disp ... g-and-test
Here is my code currently:
Code: Select all
// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// parrot.bmp, miniwoof.bmp and BANNED.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat.h> // SD card & FAT filesystem library
#include <Adafruit_ImageReader.h> // Image-reading functions
// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD
// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.
#define SD_CS 4 // SD card select pin
#define TFT_CS 10 // TFT select pin
#define TFT_DC 8 // TFT display/command pin
#define TFT_RST -1 // Or set to -1 and connect to Arduino RESET pin
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 160, // BMP image dimensions
height = 128;
void setup(void) {
ImageReturnCode stat; // Status from image-reading functions
Serial.begin(9600);
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatVolume object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
// SD card is pretty straightforward, a single call...
SD.begin(SD_CS, SD_SCK_MHZ(10)); { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
// Load full-screen BMP file 'parrot.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading parrot.bmp to screen..."));
stat = reader.drawBMP("/parrot.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?
}
I am happy to upload a photo of my setup, or draw out a wiring diagram for anyone who can help.
Thanks!