Randomly moving pixels Hi I have a 5 meter APA102 strip (30led/meter) I would

Randomly moving pixels

Hi
I have a 5 meter APA102 strip (30led/meter)
I would like to make a effect of randomly moving pixels around the strip (random number of pixels 1–5 moving from top to bottom)

Random number of pixels ON
Random number of pixels OFF
Random number of pixels ON
Random number of pixels OFF
.
.
.
.
and so on
Moving around the strip

Could you please advise where to start with
Is there any example code available.
I am using Arduino Mega and Fastled
Thanks

Break the animation idea you want down into parts. Here’s my initial ideas of how I might go about it.

  • use a Boolean variable to switch between sending On or Off pixels.
  • select a random number of 1-5. Store that in a variable called count.
  • set leds[0] on or off based on Boolean variable.
  • shift all the pixels down the string one position.
  • subtract one from count
  • if count is still greater then 0, then set leds[0] on or off based on Boolean. If count has reached 0, then it’s time to toggle Boolean state and choose a new random number for count.

Use a EVERY_N_MILLISECONDS block to control the speed.

Another idea I had is maybe you could modify Jeremy’s “Matrix” code or at least use it for some ideas.
https://plus.google.com/+JeremyWilliams1/posts/7BvwZFdxj1m

I would also recommend downloading and running some of the >>>plethora<<< of available (and Googleable) examples that have been published and then going from there. To me, the best way to learn is to see what already works then then muck around with it.

I didn’t even think about writing my own routines until I had exhausted all of the ones that had already been published…

Oh, and like Marc says, break things up and start small.

@marmil
Thank you for the hints.
I will try and update soon

@marmil
Hi

I have created the code to move random pixels using the link(jeremy williams) and your ideas provided. It was really helpful.

Please look at the video

I would like to blend the blue random pixel drop through green pixels at the end of the strip(I should be able to see the blue pixels drop right till the end of the strip).

Also the green pixels at the end
should be gradient in brightens(pixel 144 through pixel 124 brightness is 100% to 25%)

Please advise

Thank you

Posed code here.

Looking good Neo.
FastLED has a blend (and nblend) function you might check out.
https://plus.google.com/+JackKeeney1/posts/TYG3gDFT3AS

The Arduino “map” function also came to mind.
https://www.arduino.cc/en/Reference/Map

fill_gradient is something you might look into.

And also gradient color palettes.

Look here for adding colors together.

There’s multiple ways to do things. Keep going and experimenting! Save your current file and try a completely new route to get where you want to go.

@marmil
Thank you for your time.
I have two animation on a single strip
How Can I change the brightness of each animation independently on the fly.

Also in my project 1 - N leds are constantly ON (only blue color) with brightness level 25 - 150
How Can I make this gradient.

I tried with fadetoblack but couldn’t make it

Please advise

Thanks again