Im using a TFT LCD display, and im trying to show an image from the SD card. SD card has is being initialize and the image is being correctly identify from the sd card, however is not showing up on the screen. And yes, image is 24 bit bmp.
Im using an example code:
// include the necessary libraries
#include <SPI.h>
#include <SD.h>
#include <TFT.h> // Arduino LCD library
// pin definitions
#define SD_MOSI ,TFT_SDA 11
#define SD_MISO 12
#define SD_SCK ,TFT_SCK 13
#define SD_CS 4
#define TFT_CS 10
#define TFT_DC 8
#define TFT_RST 9
TFT TFTscreen = TFT(TFT_CS, TFT_DC, TFT_RST);
// this variable represents the image to be drawn on screen
PImage logo;
void setup() {
// initialize the GLCD and show a message
// asking the user to open the serial line
TFTscreen.begin();
TFTscreen.background(255, 255, 255);
TFTscreen.stroke(0, 0, 255);
TFTscreen.println();
TFTscreen.println("Arduino TFT Bitmap Example");
TFTscreen.stroke(0, 0, 0);
TFTscreen.println("Open serial monitor");
TFTscreen.println("to run the sketch");
delay(2000);
// initialize the serial port: it will be used to
// print some diagnostic info
Serial.begin(9600);
while (!Serial) {
// wait for serial line to be ready
}
// clear the GLCD screen before starting
TFTscreen.background(255, 255, 255);
// try to access the SD card. If that fails (e.g.
// no card present), the setup process will stop.
Serial.print("Initializing SD card...");
if (!SD.begin(SD_CS)) {
Serial.println("failed!");
return;
}
Serial.println("OK!");
// initialize and clear the GLCD screen
TFTscreen.begin();
TFTscreen.background(255, 255, 255);
// now that the SD card can be access, try to load the
// image file.
logo = TFTscreen.loadImage("2.bmp");
if (!logo.isValid()) {
Serial.println("error while loading i.bmp");
}
if (logo.isValid() == false) {
return;
}
Serial.println("drawing image");
// draw the image to the screen
TFTscreen.image(logo, 0, 0);
}
void loop() {
// we don't need anything here
}
Are you sure that the display is connected correctly? And what does it actually work?
You took the picture too early. First, make sure that at least the examples from the library work for you
If I disconnect the SD pins (11,13) initialization fails, if i disconnect the TFT pins (11,13) everything runs okay but nothing comes up on the TFT screen.
According to the internet you can connect different system to the I2C pins.
You should disconnect them from SD-module only and not from TFT and adrduino. And of course you should remove all parts the code regarding to the SD from the sketch.
Than test, ether the TFT will works.
It is not a I2c connection, it is SPI... at least a connection of the SD card.