tft color test and text output

This commit is contained in:
Tower committed 2026-04-12 13:05:09 +02:00
1 parent 81a242fbb8
commit 85291637ac
1 file changed
+35
@@ -0,0 +1,35 @@
#include <Adafruit_GFX.h>
#include <MCUFRIEND_kbv.h>
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;
}