Need help with Activating looping functions in UiFLow
-
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.
-
@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.