#include <Adafruit_ILI9341.h>
#define TFT_CS 15 // Chip Select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST 4 // Reset pin (could connect to Arduino's reset pin)
// Create instance of the display
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
// Initialize Serial for debugging
Serial.begin(115200); // Start serial communication at 115200 baud
Serial.println("Initializing TFT...");
// Initialize TFT interface
tft.begin();
Serial.println("TFT initialized.");
// Clear screen with a black background
tft.fillScreen(ILI9341_BLACK);
// Set text color to white
tft.setTextColor(ILI9341_WHITE);
// Set text size
tft.setTextSize(2);
// Set text cursor position
tft.setCursor(0, 0);
// Print text
tft.println("Hello, ESP32!");
}
void loop() {
// Your application code here
}