Files
klubhaus-doorbell/sketches/doorbell-touch-esp32-32e/doorbell-touch-esp32-32e.ino
2026-02-15 16:36:28 -08:00

27 lines
553 B
C++

#include <TFT_eSPI.h>
#include <SPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup() {
Serial.begin(115200);
tft.init();
tft.setRotation(1); // Landscape
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);
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);
tft.fillCircle(x, y, 3, TFT_RED);
}
}