#include <SPI.h>
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ILI9341.h> // Hardware-specific library for ILI9341
// Pin Definitions for ILI9341
#define TFT_CS 10
#define TFT_RST 9
#define TFT_DC 8
// Create ILI9341 object
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
// Initialize Serial Monitor
Serial.begin(9600);
// Initialize TFT display
tft.begin();
// Set rotation of the display (optional)
tft.setRotation(4); // Adjust the rotation value as needed
}
void loop() {
// Clear screen
tft.fillScreen(ILI9341_BLACK);
// Set text color
tft.setTextColor(ILI9341_WHITE);
// Set text size
tft.setTextSize(2);
// Set text cursor position
tft.setCursor(0, 20);
// Print colored text
tft.setTextColor(ILI9341_RED);
tft.println("Red text");
tft.setTextColor(ILI9341_GREEN);
tft.println("Green text");
tft.setTextColor(ILI9341_BLUE);
tft.println("Blue text");
tft.setTextColor(ILI9341_YELLOW);
tft.println("Yellow text");
tft.setTextColor(ILI9341_MAGENTA);
tft.println("Magenta text");
tft.setTextColor(ILI9341_CYAN);
tft.println("Cyan text");
// Pause before clearing the screen and repeating the loop
delay(5000);
}