Overwrite with "printf" command



  • I'm trying to put on the lcd a number with the command "printf", but the screen writes the number over the previous one, so the result is a colored square in a short time.
    I attach the code I'm using in case anyone can help me, thanks in advance.

    #include <M5Stack.h>
    …….
    double tiempoSegundos= 0;
    void Printseg() // Presenta los seg en pantalla
    {
    M5.lcd.setCursor(0,180);
    M5.Lcd.printf(" %6.3f",tiempoSegundos );
    }
    void setup() {
    M5.begin(); // inicio del M5S:

    …..
    void loop() {
    ……
    Printseg(); }



  • 1 clear whole screen before print (possible flicker screen)
    2 print same text on the same position with background color
    3 draw filled rectangle with background color that cover area where text was printed



  • Yes, correct I used the " M5.Lcd.setTextColor (YELLOW, BLACK);" in the setup command , and effectively overwriting by deleting the above. Thank you.
    Greetings.