This commit is contained in:
2026-02-15 16:50:20 -08:00
parent fadcb684cc
commit f4045cdb98

View File

@@ -5,21 +5,36 @@ TFT_eSPI tft = TFT_eSPI();
void setup() {
Serial.begin(115200);
delay(1000);
// Turn on backlight
pinMode(27, OUTPUT);
digitalWrite(27, HIGH);
tft.init();
tft.setRotation(1); // Landscape
// Cycle colors to confirm display works
uint16_t colors[] = {TFT_RED, TFT_GREEN, TFT_BLUE, TFT_WHITE};
const char* names[] = {"RED", "GREEN", "BLUE", "WHITE"};
for (int i = 0; i < 4; i++) {
tft.fillScreen(colors[i]);
Serial.printf("Screen: %s\n", names[i]);
delay(1000);
}
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setTextSize(2);
tft.drawString("Hello from ESP32!", 20, 20);
tft.fillCircle(160, 120, 50, TFT_BLUE);
tft.setTextSize(3);
tft.drawString("Hello ESP32-32E!", 30, 100);
Serial.println("Display initialized!");
}
void loop() {
// Touch test
uint16_t x, y;
if (tft.getTouch(&x, &y)) {
Serial.printf("Touch at: %d, %d\n", x, y);
Serial.printf("Touch: %d, %d\n", x, y);
tft.fillCircle(x, y, 3, TFT_RED);
}
}