I feel like this should be super simple,

(John Hendy) #1

I feel like this should be super simple, but it’s really giving me a hard time! I have a circle of 48 WS2812b’s and I wanted to create an animation like so:

  • there’s a basline bpm
  • hue, saturation, and a target pixel oscillate their values at different ratios of bpm
  • the lead pixel is brighter, with fading to a min brightness surrounding it on one or both sides

So, I tried this:

For one, it doesn’t seem to work (the brightest pixels seem to stay in the middle). Two, it seems like there has to be a much better/simpler way to animate a bright “spot” flowing around a circle using CHSV or varying saturation, delta between hues, etc. (I can do a cycling spot by manually setting CRGB values individually).

I’m looking for something like sin8 or beatsin8 that would “spill over” instead of oscillating back and forth. Those animations are quite smooth, but with getting the general bpm to where I want it, I’m setting EVERY_N_MILLISECONDS to run every 100 ms, which I think is probably part of the cause (running at relatively low brightnesses).

Thanks for any comments/suggestions!

(Dirk Vinkx) #2

i dont exactly uderstand the effect you want .?
But is it somthing similar to this ?

(Mark Kriegsman) #3

Check out beat8. It generates a sawtooth wave ramping from 0 up to 255 and then starts again at 0 and ramps up again. It’s like beatsin8, but without the sine wave.

(Dirk Vinkx) #4

I cant get a grasp on how i can use beat8 to make a sawtooth patern. I tried it but all the leds go out at the same time.

(John Hendy) #5

Thanks for the code, @Dirk_Vinkx ! Sadly to say I haven’t tried it yet (pretty busy), but I think it looks like it’ll do what I want! Clever algorithm, or at least it didn’t occur to me. This will result in a “one-way” tail, correct? In other words, you’re going to fade the 48th LED (which will be adjacent to the lead LED) by 48*5.3. Just contrasting that to having a peak with symmetrical fading on either side.

I’ll try it tonight or this weekend. Here’s the animation I made using beatsin8(), which does basically what I want except per this post was hoping it would just continue around and around:

Just wanted to illustrate what I meant by oscillating saturation and hue delta (note that sometimes it’s mostly one color tone vs. a distinct gradient, and fades from quasi-saturate to nearly white).

Also, hat tip to Marc Miller for the tubing idea! Works like a charm :slight_smile:

(Dirk Vinkx) #6

yes that is a one way tail.Meanwhile i got that beat8 sawtooth thing figured out, made it a bit smoother and threw in a saturation variation .