From 85291637ac0929de7006c9e39efed765a662bfff Mon Sep 17 00:00:00 2001 From: Tower Date: Sun, 12 Apr 2026 13:05:09 +0200 Subject: [PATCH] tft color test and text output --- .../TFT-Display-HelloWorld.ino | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 TFT-Display-HelloWorld/TFT-Display-HelloWorld.ino diff --git a/TFT-Display-HelloWorld/TFT-Display-HelloWorld.ino b/TFT-Display-HelloWorld/TFT-Display-HelloWorld.ino new file mode 100644 index 0000000..741dd7a --- /dev/null +++ b/TFT-Display-HelloWorld/TFT-Display-HelloWorld.ino @@ -0,0 +1,35 @@ +#include +#include +MCUFRIEND_kbv tft; + +#define BLACK 0x0000 +#define BLUE 0x001F +#define RED 0xF800 +#define GREEN 0x07E0 +#define YELLOW 0xFFE0 +#define WHITE 0xFFFF + +uint16_t colors[] = {WHITE, RED, GREEN, BLUE, YELLOW}; +int colorIndex = 0; + +int rotation = 0; + +void setup() { + uint16_t ID = tft.readID(); + tft.begin(ID); +} + +void loop() { + tft.setRotation(rotation); + tft.fillScreen(BLACK); + tft.setCursor(50, 50); + tft.setTextColor(colors[colorIndex]); + tft.setTextSize(3); + tft.println("TEXT"); + + delay(2000); + + rotation = (rotation + 1) % 4; + int laenge = sizeof(colors) / sizeof(colors[0]); + colorIndex = (colorIndex + 1) % laenge; +} \ No newline at end of file