ILI9341 TFT display not working

Hi I am working with 240x320 TFT SPI display.

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>


#define TFT_CS    5
#define TFT_RST  16 
#define TFT_DC    15
#define TFT_MOSI  23
#define TFT_CLK   18
#define TFT_MISO  19


Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_CLK, TFT_MISO);

void setup() {
  Serial.begin(115200);

  tft.begin();
  tft.setRotation(1); 
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_WHITE);
  tft.setTextSize(2);
}

void loop() {
  tft.fillScreen(ILI9341_BLACK);
  tft.setCursor(0, 0);
  tft.println("Hello, World!");

  delay(2000);
}

This is the code I'm currently using. The issue is the display lights up but the text wont show up. I'm using esp32 and I have pins setup this way:
VCC ==> 3.3V
GND ==> GND
CS ==> 5
RESET ==> 16
DC ==> 17
SDI(MOSI) ==> 23
SCK ==> 18
LED ==> 3.3V
SDO(MISO) ==> 19

Here is the full photo:


Here is the backside of display:

Tried a couple of things from internet but in no avail.Yes i have J1 soldered. Any help is appreciated. Thanks :banana:

A few things:

  1. it's a TFT LCD display, not an OLED display.

  2. You're using software SPI, which is incredibly slow.

  3. You have the order of the pins in the constructor wrong.
    You have:

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_CLK, TFT_MISO);

and it's supposed to be:

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
  1. Since you're using the hardware SPI pins anyway, you can gain a big speed advantage by using hardware SPI.
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

But, software or hardware SPI, once you've got the constructor sorted out, it works.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.