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

    Overwrite with "printf" command

    Scheduled Pinned Locked Moved Arduino
    3 Posts 2 Posters 7.1k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post