1 button to cycle 2 lights

Hi!

I’m struggling a bit setting this up, and you guys probably have this one long figured out.

I have 2 lights. I want to use 1 button. 1 tap, light 1 comes on. 2 taps, 2nd light also comes on. 3rd tap, 2nd light turns off, just the first light is on. 4th tap, left light turns off so all are off. Kind of like a 4 part cycle. I’ve tried it this way, but for some reason when I tap the third time, the second light comes on instead of the first.

Is there a better way to organize this flow, should I be using variables or logic?

I set it up orginally with both “is turned on, and is turned off” cards for each light, and tried to simplify it to just use the “and” cards for “is turned on”.

Thanks in advance, I’ve been setting up switches and lights all day and my brain is fried. haha. <3

The problem is your sequencing, when only light one is on and you press the button, how does your flow know if you want it to turn light one off, or turn light two on? Perhaps assign a number variable with different numbers depending on the state and direction. Change the number on each press and then depending upon the number turn the relevant lights on or off?

Like @Drako74 already suggested I would use a number-variable ‘click-counter’ and add 1 to it each time the button is pressed unless the value is 4. If the value is 4 start with value 1 again.

The FlowBits app has a set of cards to implement that approach.

Andy

@Drako74 as well, I’ve never touched variable numbers before so that was a bit of a ride, but you two just changed my entire flowstyle forever. I copied your flow @Wim_Post and I learned how to use variable logic for the first time LOL, and actually how to apply it.

THANK YOU <3 you’re a rockstar. It’s so much easier than the thousand cards. haha.

here are all of the leftover cards from my failed approaches. :rofl: