snapshot
This commit is contained in:
@@ -5,21 +5,36 @@ TFT_eSPI tft = TFT_eSPI();
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
|
// Turn on backlight
|
||||||
|
pinMode(27, OUTPUT);
|
||||||
|
digitalWrite(27, HIGH);
|
||||||
|
|
||||||
tft.init();
|
tft.init();
|
||||||
tft.setRotation(1); // Landscape
|
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.fillScreen(TFT_BLACK);
|
||||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
tft.setTextSize(2);
|
tft.setTextSize(3);
|
||||||
tft.drawString("Hello from ESP32!", 20, 20);
|
tft.drawString("Hello ESP32-32E!", 30, 100);
|
||||||
tft.fillCircle(160, 120, 50, TFT_BLUE);
|
|
||||||
Serial.println("Display initialized!");
|
Serial.println("Display initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// Touch test
|
|
||||||
uint16_t x, y;
|
uint16_t x, y;
|
||||||
if (tft.getTouch(&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);
|
tft.fillCircle(x, y, 3, TFT_RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user