4 inch tft display for arduino mega deosn't work

I've bought recently a tft screen from AliExpress:
aliexpress.com

And I'm trying to code it, but I can't find a way.
The most I've done is showing for a split second every time I run the code a light-blue background even when in the code it's meant to be a black background.

I can see that the backlight is on, so it's not a problem of "it's not connected".

Welcome to the forum

which Arduino board are you using ?

Please post your test code, using code tags when you do

Thanks for response.

I'm using Mega2560, and I've lost the code (I've genrated it with AI but I closed it and it doesn't save)

The last code I used is:

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

#define TFT_MISO 50
#define TFT_SCK 43
#define TFT_MOSI 51
#define TFT_DC 38
#define TFT_RESET 41
#define TFT_CS 40
Adafruit_ILI9340 myScreen = Adafruit_ILI9340(TFT_CS, TFT_DC, TFT_RESET, TFT_SCK, TFT_MOSI, TFT_MISO);


void setup() {
  // Initialize the TFT screen
  myScreen.begin();
  
  // Set the background color
  myScreen.fillScreen(ILI9340_GREEN);
}

you may be using the incorrect library
have a look at 4.0inch_Arduino_Display-Mega2560_NT35510 and Adafruit_NT35510

Thanks!!!

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