#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ILI9341.h> // ILI9341 TFT library
// Pin configuration for ESP32
#define TFT_CS 5 // Chip select
#define TFT_RESET 4 // Reset pin
#define TFT_DC 17 // Data/Command
// Create the TFT display object
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RESET);
// Define an array of colors for each letter
uint16_t colors[] = {ILI9341_RED, ILI9341_GREEN, ILI9341_BLUE, ILI9341_YELLOW, ILI9341_CYAN, ILI9341_MAGENTA, ILI9341_WHITE, ILI9341_ORANGE, ILI9341_PURPLE};
void setup() {
// Start Serial Monitor for debugging
Serial.begin(115200);
delay(1000);
// Initialize the TFT display
tft.begin();
tft.setRotation(3); // Set to landscape mode (rotation 0, 1, 2, or 3)
// Fill the screen with a background color
tft.fillScreen(ILI9341_BLACK);
// Set text size
tft.setTextSize(3); // Set text size (1 to 5)
// Print each letter of "Harsentael" in different colors
String text = "Harsentael";
int yPos = 50; // Starting Y position for vertical text
// Loop through each letter in the string "Harsentael"
for (int i = 0; i < text.length(); i++) {
// Set the text color for each letter (cycling through colors)
tft.setTextColor(colors[i % 9]); // Cycle through 9 colors
tft.setCursor(100, yPos); // Set X position to 100 (adjust if needed) and Y position for vertical text
tft.print(text[i]); // Print the character
yPos += 40; // Move Y position down for the next letter (adjust as needed)
}
}
void loop() {
// Nothing to do in the loop for now
}