Same Direction Single-Color LED Chase Sequence

I have a 2812B LED strip (RBG) that I need to create in a single-color chase sequence.

It would be similar to a "Knight Rider" type effect except for the fact that it goes only one direction.

With ONE led strip, I want to create an effect SIMILAR to this video

Yes, I know it will only be 1 LED wide, but I am showing you this so you can understand what I am looking for. Unlike the KNIGHT RIDER effect, I don't want it to bounce back.

In order for it to "chase" it would need to have more than 1 pixel/led on at a time, but just "moving" in the same direction.

Typically I use the Neopixel library, but could use other things if necessary.

Thank you in advance for any direction you may give me in my search!!!

Let's say you have 4 LEDs.

ledStates[4] = {1, 0, 1, 0};

LED0 = ledStates[i % 4]
LED1 = ledStates[(i + 1) % 4]
LED2 = ledStates[(i + 2) % 4]
LED3 = ledStates[(i + 3) % 4]

start at i = 0
LED0 = 1
LED1 = 0
LED2 = 1
LED3 = 0

...

next iteration when i = 1
LED0 = 0
LED1 = 1
LED2 = 0
LED3 = 1

Give that a try.

I want to create the effect of linear motion using a strand of led lights. I believe that is called a chase. But I want multiple lights scrolling or chasing along the strip at the same time so you can choose which light to follow with your eyes as it progresses across

Basically you are looping.

I think the code thoughts I wrote up would be a good starting point.

ieee488:
Basically you are looping.

I think the code thoughts I wrote up would be a good starting point.

The code you posted was not in code tags. Given the number of posts you have that is a very bad example to set. Also there are no ; in that code.

Grumpy_Mike:
The code you posted was not in code tags. Given the number of posts you have that is a very bad example to set. Also there are no ; in that code.

In short, it simply isn't usable. :roll_eyes:

I guess, it might be called a theater chase???

There are many ways to go about this.
Some pseudo-code:
turn on 1,2,3,4
delay
turn off 1
turn on 5
delay
turn off 2
turn on 6
delay
turn off 3
turn on 7
delay
turn off 4 ...
and so on

It's not compact and refined - but can you "see" what should be done, now? [ Y/N ]

Grumpy_Mike:
The code you posted was not in code tags. Given the number of posts you have that is a very bad example to set. Also there are no ; in that code.

It isn't code.

I did write the words code thoughts.

I expect the OP to take my ideas and go from there.

Paul__B:
In short, it simply isn't usable. :roll_eyes:

It isn't if you expect to cut and paste it.

And as I wrote before it is code thoughts. I never wrote that it was code. My intention was to give the OP some suggestions, musings, whatever you want to call it.

ieee488:
I did write the words code thoughts.

No you didn't.
Anyway the words you should have used was pseudo code.

Grumpy_Mike:
No you didn't.
Anyway the words you should have used was pseudo code.

I didn't? ? ? ?

Re-read post #3 above.

And, yes, thank you for the schooling on the use of the words "pseudo code". :roll_eyes:

Re-read post #3 above.

Sorry while I read that I did not associate those words with the code you posted previously.