Clearing TFT without [.fillScreen] the whole screen.

Hi everyone!

I’ve more or less solved my problem, that when I want to periodically refresh data on my TFT, the new characters get written over the last ones creating an unreadable mess.

I just use

screen.fillScreen(0);
screen.text(powerPrintout, 10,10);

that does the job. BUT now it kinda flickers. Everytime a new value gets printed, the screen goes black and then prints the variable because of the above lines, but the “going black” part is annoying. Can’t I just overwrite the variable? Is there no “clear()” function or anything?

Below will be the part of my code that is important for the whole screen stuff. I really hope someone can enlight me, it can’t be that hard! :confused:

#include <TFT.h>
#include <SPI.h>

#define currentSensor A0
#define CS    10
#define DC    8
#define RESET 9

TFT screen = TFT(CS, DC, RESET);

void setup() {
  screen.begin();
  screen.setRotation(0);
  screen.background(0,0,0);
  screen.stroke(255,255,255);
  screen.setTextSize(2);
  screen.noFill();
}

void loop() {
  screen.fillScreen(0);
  screen.text(powerPrintout, 10,10);
}

Hi, Refreshing text/numbers on a TFT is usually done by setting foreground colour to the same as background colour and re-writing old text/numbers before writing new text at the same position after restoring original foreground colour. You could also draw a small rectangle to cover old text in background colour first.

hope this helps.

Trevor.