mirrored 2.8" elegoo tft

Hi, I’ve been reading through the forum for some help but I couldn’t find anything that fixes my problem. My text is mirrored on my display. When I use the graphicsTest from the elegoo tftlcd library everything looks fine, but when I try and use my own code the text read from right to left. Please help! I am using an Arduino Mega with a 2.8" tft ILI9341 and if it helps, the code I’m using is below.

#include <Elegoo_GFX.h>    // Core graphics library
#include <Elegoo_TFTLCD.h> // Hardware-specific library


#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0

#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin


#define  BLACK   0x0000
#define BLUE    0x001F
#define RED     0xF800
#define GREEN   0x07E0
#define CYAN    0x07FF
#define MAGENTA 0xF81F
#define YELLOW  0xFFE0
#define WHITE   0xFFFF

Elegoo_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);

boolean inMenu = true;

void setup(){
  Serial.begin(9600);
  tft.reset();
  uint16_t identifier = 0x8357;
  tft.begin(identifier);
  tft.setRotation(1);
  Serial.println("Starting up...");
  Serial.print("TFT size is "); Serial.print(tft.width()); Serial.print("x"); Serial.println(tft.height());
  
}

void loop() {
  testText();
}

unsigned long testText() {
  tft.fillScreen(BLACK);
  tft.setCursor(0,0);
  tft.setTextColor(WHITE); tft.setTextSize(3);
  tft.println("hello world!");
  delay(10000);
}

First off. Please post a link to the actual display that you bought. e.g. Ebay sale page.

2.8" tft ILI9341

could mean anything. You can't expect readers to guess.

If it really does have an Ilitek ILI9341 controller then these lines will guarantee failure:

  uint16_t identifier = 0x8357;
  tft.begin(identifier);

because they are intended for a Himax HX8357D controller.

David.

david_prentice:
First off. Please post a link to the actual display that you bought. e.g. Ebay sale page. could mean anything. You can't expect readers to guess.

If it really does have an Ilitek ILI9341 controller then these lines will guarantee failure:

  uint16_t identifier = 0x8357;

tft.begin(identifier);



because they are intended for a Himax HX8357D controller.

David.

david_prentice:
First off. Please post a link to the actual display that you bought. e.g. Ebay sale page. could mean anything. You can't expect readers to guess.

If it really does have an Ilitek ILI9341 controller then these lines will guarantee failure:

  uint16_t identifier = 0x8357;

tft.begin(identifier);



because they are intended for a Himax HX8357D controller.

David.

this is the link to the screen I'm using

Thanks for the link.

It says: ILI9341
A photo of the blue pcb shows a voltage regulator chip in the top-right

I am intrigued. Is the voltage regulator present? e.g. AMS1117-3.3
Are U2, U3 74HC245 or 74LVC245 ?

You would normally use this typical sequence:

    uint16_t ID = tft.readID();  //should be 0x9341 for an ILI9341
    tft.begin(ID);

I don’t know how well Elegoo_TFTLCD works. It is a hacked version of Adafruit_TFTLCD library.
I presume that it works ok.

David.