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

    Need help with Activating looping functions in UiFLow

    Scheduled Pinned Locked Moved UIFlow
    4 Posts 2 Posters 1.8k 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.
    • I Offline
      icarus121
      last edited by

      Hello everyone, I'm very new to programing and this is my first venture into M5Stack Core2 and UiFlow. I'm in need of some help with some looping light functions. I was playing around with the Breathing RGB Demo and was trying to alternate between to sets of looped lighting setting which I could activate with buttons. I can get one of the looped flashing lighting effects, but when I press the second button the light doesn't change to the next effect. I can not seem to break or exit out of the current loop to switch to the next effects loop. I'm sure I'm missing something dumb and simple, but I'm not sure what I'm doing wrong. Please help a beginner, learn the ways of UiFlow. Thank you.

      Screen 1.jpg
      Screen 2.jpg Screen 3.png

      1 Reply Last reply Reply Quote 0
      • kurikoK Offline
        kuriko
        last edited by

        @icarus121
        Your problem is that you use "loop" in the callback function of "touchbutton0_was_pressed". This will cause your program to loop forever.
        I recommend you add a flag to indicate whether button1 or button2 is pressed: in the loop, if button1 is pressed, execute program 1; the same applies to button2.
        f5f25e2a-1436-444f-8dc6-f8a26b5b918c-image.png

        Good morning, and welcome to the Black Mesa Transit System.

        I 1 Reply Last reply Reply Quote 0
        • I Offline
          icarus121 @kuriko
          last edited by

          @kuriko

          Thank you so much for your help Kurikio. And for your crazy fast response. This is exactly what I needed to get myself back on the right path. I through together a quick test this morning and everything is now running smoothly and I'm able to change between different lighting setting with out the program crashing or getting stuck in a endless loop.

          Here's what I ended up putting together. Three buttons on the display that could change between three preset colors and a effect pattern, the A and B buttons mirrored the first 2 button and the C button turned off the lights.

          Thank again so much for your help. Here are some photo of my end result:

          Screen 1.1.jpg

          Screen 2.1.jpg

          Screen 3.1.png

          kurikoK 1 Reply Last reply Reply Quote 1
          • kurikoK Offline
            kuriko @icarus121
            last edited by

            @icarus121
            great job!

            Good morning, and welcome to the Black Mesa Transit System.

            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