#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
// Define TFT pins
#define TFT_CS 15
#define TFT_DC 2
#define TFT_RST 4
// Create TFT display instance
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
tft.begin(); // Initialize the display
tft.setRotation(1); // Set display orientation (0-3)
tft.fillScreen(ILI9341_RED); // Clear screen with black color
// Draw text
tft.setTextColor(ILI9341_BLACK);
tft.setTextSize(3);
tft.setCursor(10,10);
tft.println("Hello, ESP32!");
// Draw shapes
tft.drawRect(50, 50, 200, 100, ILI9341_WHITE);
tft.fillCircle(160, 120, 30, ILI9341_BLUE);
}
void loop() {
// Blink text example
tft.setCursor(10, 100);
tft.setTextColor(ILI9341_YELLOW);
tft.print("Blinking Text");
delay(500);
tft.fillRect(10, 100, 280, 30, ILI9341_BLACK); // Erase text
delay(500);
}