I want to use a 4inch TFT display on the Arduino r4 WiFi. It showed nothing the first time. After a little bit of digging on the Arduino forums I came across a person with the exact same problem as me here. I had to use the MCUFRIEND library and add some stuff to utility/mcufriend_shield in the MCUFREIND library. Now it shows a white screen
#include <MCUFRIEND_kbv.h> // Hardware-specific library for MCUFRIEND shields
MCUFRIEND_kbv tft; // Create an instance of the display
// Define color constants
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
void setup() {
uint16_t ID = tft.readID(); // Identify the display
tft.begin(ID); // Initialize the display
tft.setRotation(1); // Set the rotation (0-3)
tft.fillScreen(BLACK); // Clear the screen with black color
tft.setTextColor(WHITE); // Set text color to white
tft.setTextSize(2); // Set text size to 2
tft.setCursor(50, 50); // Set the cursor at x=50, y=50
tft.print("Hello, ILI9486!"); // Print a message on the display
}
void loop() {
// Empty loop
}