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

    Blinking characters

    UIFlow
    3
    9
    11.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
      marcvl
      last edited by

      I would like to display blinking characters to the Core2 UI. Any ideas on how I can do this? Is this possible with UIFlow?

      world101W 1 Reply Last reply Reply Quote 0
      • world101W
        world101 @marcvl
        last edited by

        @marcvl said in Blinking characters:

        I would like to display blinking characters to the Core2 UI. Any ideas on how I can do this? Is this possible with UIFlow?

        At first thought, you could use a recurring (periodic) timer and overwrite the same text string with the background color, then back to the font color. That should produce a blinking pattern, but I have not tested it yet.

        1 Reply Last reply Reply Quote 1
        • M
          marcvl
          last edited by marcvl

          If my understanding is correct, you can only have one active timer running at any given moment. The blinking is used to indicate that another timer is running, so I wouldn’t be able to start a new timer without interrupting the other one.

          Is there no custom code I could create to generate a blinking effect?

          world101W 1 Reply Last reply Reply Quote 0
          • world101W
            world101 @marcvl
            last edited by world101

            @marcvl

            You can have multiple timers running at the same time. I like to off-set them by an odd number of milliseconds to reduce the chance of them firing at exactly the same time, but that's up to you and how complicated or time sensitive your program is going to be. Here is an example of two timers running: one for a simple 1-second counter and the other will blink the text in 133 ms periods while the other timer is running (called from the seconds_timer). Buttons A and B will start and stop the counter.

            0_1616110478106_Screen Shot 2021-03-18 at 7.31.47 PM.png

            You could also achieve the same blinking text with the Set label0 show/hide block, instead of toggling the text color between the primary color and the background color. That worked for me as well.

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

              That's great! Now, I must be going crazy... I implemented your exact code and my text doesn't blink... It blinks once when I start the timer and that's it.0_1616114581599_Screen Shot 2021-03-18 at 5.41.26 PM.png

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

                And if I remove the second timer and implement blinking as part of timer 1, then it works. Which is why I originally thought you could only have 1 timer.

                0_1616115165330_Screen Shot 2021-03-18 at 5.51.43 PM.png

                world101W 1 Reply Last reply Reply Quote 0
                • world101W
                  world101 @marcvl
                  last edited by world101

                  @marcvl said in Blinking characters:

                  I implemented your exact code

                  Not quite exact... I see your issue. You are missing one block that differs from my flow...

                  0_1616115274904_Screen Shot 2021-03-18 at 7.31.47 PM.png

                  T 1 Reply Last reply Reply Quote 1
                  • M
                    marcvl
                    last edited by

                    Embarrassing:). You are right. All works now. I used to put text on the screen using the print function. But doing this as a label is much better. Thanks!

                    1 Reply Last reply Reply Quote 0
                    • T
                      thunavarro @world101
                      last edited by

                      @world101 said in Blinking characters:

                      @marcvl wordle unlimited said in Blinking characters:

                      I implemented your exact code

                      Not quite exact... I see your issue. You are missing one block that differs from my flow...

                      0_1616115274904_Screen Shot 2021-03-18 at 7.31.47 PM.png

                      Thank you so so much. This answer was very very useful to me.

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