Has any one been able to create a chasing light piston


#1

Looking for and idea on how to create a chasing light scenario.

I have 4 Lifx rgbw lights outside. Each set to various colors. What I would like to do is:

Light 1 red
Light 2 white
Light 3 blue
Light 4 red

With a piston change light 2 to light 1 color, then light 3 change to light 2 old color. Etc.

So they appear to chase each other.

Any ideas. I want to keep it simple and hopefully not this massive piston with a bunch of timers. But willing to try anything at this point


#2

Me too!! I’ve been trying to figure out this exact scenario for my outdoor LIFX bulbs. I’m a coding noob, so I’m struggling. lol


#3

Isn’t this sort of thing possible directly from the LIFX app? Try setting all the bulbs into a group, then select that group and choose a theme (ie: “Independence Day”). Then choose Effects and “Animate Theme” I think.


#4

What about something like this?

Set variables
Colors = red, white, blue
MaxColors = count(Colors) [or 3 if that function doesn’t work)
LightCount = 4
Counter (integer) = 1
ColorChoice (integer) = 0

every x seconds/minutes, whatever you want the change frequency to be

for loop (Counter variable 1 to LightCount)

Set light1 = arrayItem(ColorChoice,Colors)
If ColorChoice = Max Colors, then set ColorChoice = 0; else ColorChoice+1

Set light2 = arrayItem(ColorChoice,Colors)
If ColorChoice = Max Colors, then set ColorChoice = 0; else ColorChoice+1

Set light3 = arrayItem(ColorChoice,Colors)
If ColorChoice = Max Colors, then set ColorChoice = 0; else ColorChoice+1

Set light4 = arrayItem(ColorChoice,Colors)
If ColorChoice = Max Colors, then set ColorChoice = 0; else ColorChoice+1

Wait x seconds or minutes (set relative to the time you have your piston execute. For example, if this piston runs every 1 minute, the wait time here should be 15 seconds so it completes all 4 rotations before the piston is called again… the loop will run at 0 seconds, 15, 30, and a final one at 45. Then the piston is called again at 60 seconds, keeping the intervals even)

Counter = Counter +1

I don’t have color lights to try it out, but I think the logic is roughly there - might take some tweaking to get it the way you want.