/*
Beispiel für
https://forum.arduino.cc/t/tft-input-placeholder/1107597
2023-03-29
ec2021
*/
#include "TFTCursor.h"
#define LEFT 50
#define TOP 80
CursorType myCursor;
void Print(String txt, int atX, int atY, int tSize, uint16_t col){
tft.setCursor(atX, atY);
tft.setTextColor(col);
tft.setTextSize(tSize);
tft.println(txt);
//myCursor.setAll(atX, atY,col, tSize, 0); // oder einzeln:
myCursor.setCursor(atX, atY);
myCursor.setTextColor(col);
myCursor.setTextSize(tSize);
myCursor.setBlinkTime(500);
};
int Stelle = 0;
int count = 1;
int textSize = 1;
unsigned long lastChange = 0;
void setup() {
tft.begin();
tft.setRotation(0);
Print("00:00",LEFT, TOP, textSize, ILI9341_RED);
}
void loop() {
myCursor.Blink(Stelle);
if (millis()-lastChange > 3000){
lastChange = millis();
Stelle++;
if (Stelle == 2) Stelle++; // Hier ist der Doppelpunkt
if (Stelle > 4) Stelle = 0;
count++;
if (!(count % 5)) {
Print("00:00",LEFT, TOP, textSize, ILI9341_BLACK);
textSize++;
if (textSize > 6) textSize = 1;
Stelle = 0;
count = 1;
if (textSize < 3) Print("00:00",LEFT, TOP, textSize, ILI9341_RED);
else Print("00:00",LEFT, TOP, textSize, ILI9341_YELLOW);
}
}
}