Files
Arduino/TFT-Display-HelloWorld/TFT-Display-HelloWorld.ino
T
2026-04-12 13:05:09 +02:00

35 lines
718 B
Arduino

#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;
}