#include <Adafruit_GFX.h>
#include <Adafruit_ST7789.h>
#include <SPI.h>
// Pin configuration (adjust as per your wiring)
#define TFT_CS 12 // Chip Select
#define TFT_DC 18 // Data/Command
#define TFT_RST 9 // Reset
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
void setup() {
// Initialize serial for debug
Serial.begin(115200);
Serial.println("ST7789 Test Sketch Starting...");
// Initialize TFT
tft.init(240, 280);
tft.fillScreen(ST77XX_BLACK);
// Show test text
tft.setTextColor(ST77XX_YELLOW);
tft.setTextSize(2);
tft.setCursor(20, 120);
tft.println("ST7789 240x280 TFT");
tft.setCursor(20, 150);
tft.println("Arvind Patil Nandurbar");
// Draw some test graphics
tft.fillCircle(120, 200, 40, ST77XX_RED);
tft.drawRect(50, 50, 140, 60, ST77XX_GREEN);
}
void loop() {
// Simple color cycling demo
static int colorIndex = 0;
uint16_t colors[] = { ST77XX_BLUE, ST77XX_RED, ST77XX_GREEN, ST77XX_CYAN, ST77XX_MAGENTA, ST77XX_YELLOW };
tft.fillScreen(colors[colorIndex]);
delay(1000);
colorIndex = (colorIndex + 1) % 6;
}