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

    How to create an infinite loop with a manual exit

    Scheduled Pinned Locked Moved UiFlow 2.0
    5 Posts 3 Posters 441 Views
    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.
    • J Offline
      JohnSal
      last edited by

      I'm using UIFlow v2.4.2 and want to run the flashlight continuously without the current 100 cycle limit. Is there a way to trigger an infinite loop that I can break manually? Any ideas, examples or suggestions would be great!

      Picture1.png

      robskiR 1 Reply Last reply Reply Quote 0
      • robskiR Offline
        robski @JohnSal
        last edited by

        @JohnSal flashlight code inside function, function in the loop?

        M5StickC, M5StickCPlus, M5StickCplus2,M5GO, M5Core, M5Tough, M5Core2, M5 Demo Board, M5Dial, M5Paper, M5Atom, M5Cardputer, M5StampS3, CoreMP135, StamPLC, AirQ, M5Tab, M5CardputerAdv, M5StackChan

        J 1 Reply Last reply Reply Quote 0
        • J Offline
          JohnSal @robski
          last edited by JohnSal

          @robski can not drag it into the loop, it is outside
          Picture1.png

          Picture1.png

          1 Reply Last reply Reply Quote 0
          • H Offline
            holofloh
            last edited by

            3abc5f70-e64e-4c30-8088-a4ab96cba4c8-grafik.png
            Just as an idea, code not tested:
            Avoid to loop somewhere except the main loop!

            Setup:

            • Create a variable called "Button" to enable/disable the flash function
            • Create a variable called "Blink" for the current state of the light
            • Start a timer

            Button clicked:

            • Invert the state of "Button"

            Main Loop:

            • If Button is TRUE, start the timer
            • else (If it is FALSE) stop the timer
            • your other code doing somewhat

            Timer0:

            • Blink the LCD (or whatever you want) using the "Blink" variable
            J 1 Reply Last reply Reply Quote 0
            • J Offline
              JohnSal @holofloh
              last edited by JohnSal

              At the end I used switches and it works.

              Picture1.png

              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