// =====================================================
// ESP32-C3 Mini + ILI9341 TFT
// Full Hello World + Color Cycle Test
// =====================================================
#define USER_SETUP_ID 0x9341
#define ILI9341_DRIVER
// ✅ Correct Pin Mapping (ESP32-C3 Mini)
#define TFT_MISO 4 // MISO
#define TFT_MOSI 6 // MOSI
#define TFT_SCLK 7 // SCLK
#define TFT_CS 10 // Chip Select
#define TFT_DC 9 // Data/Command
#define TFT_RST 8 // Reset
// Backlight pin (connect BL/LED pin of TFT here, or tie to 3.3V)
#define TFT_BL 5
#define SPI_FREQUENCY 27000000 // safer than 40 MHz
#define SPI_READ_FREQUENCY 20000000
#include <TFT_eSPI.h>
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup() {
// Turn on backlight
pinMode(TFT_BL, OUTPUT);
digitalWrite(TFT_BL, HIGH);
// Init display
tft.init();
tft.setRotation(1); // try 0–3 if needed
// Clear screen
tft.fillScreen(TFT_BLACK);
// Show test text
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.drawString("Hello ESP32-C3!", 40, 120, 4);
}
void loop() {
// Cycle colors
tft.fillScreen(TFT_RED);
delay(1000);
tft.fillScreen(TFT_GREEN);
delay(1000);
tft.fillScreen(TFT_BLUE);
delay(1000);
// Show branding
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
tft.drawString("AI Centre Nandurbar", 30, 120, 4);
delay(2000);
}