🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Overwrite with "printf" command

    Arduino
    2
    3
    6.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Matorra
      last edited by

      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 Reply Last reply Reply Quote 0
      • R
        robalstona
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • M
          Matorra
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post