I’m after help adapting some code to run in a circular pattern.
I’m keen to get this wonderful sketch( https://gist.github.com/kriegsman/964de772d64c502760e5) from Mark Kriegsman adapted so that when a light strip is arranged in a circle the tail of the pattern will match the start, so there is a constant flowing circle of colours without a harsh break/start point.
I hope I’ve made it clear what I’m trying to achieve. Any help would be much appreciated.
Here’s a small function that I actually used to produce exactly that effect on a clock I built back in 2014.
See the following link for a video of the function at work (around 30 seconds into the video)…
There are probably more efficient ways of doing this but this definitely works 100%. I hope it gives you some ideas…
void rainbow (){
for(int i = 419; i >= 0; i--) { // The number of LEDs on the clock section to have a circular seamless rainbow
int val = i; // Start with 419, count down to 0 to produce a clockwise rainbow motion
for (int led = 0; led < NUM_LEDS; led++) { // Write a different hue value to each of the 555 leds (Including the pendulum section)
val = val++ % 420; // Step up the val for each subsequent led but maintains it within a range of 0-419
byte hue = map (val, 0, 419, 0, 255); // Maps the val to a range of 0-255 that is used by the CHSV function of the FastLED library
leds[led] = CHSV(hue, 255, LED_MAX_BRIGHTNESS); // 2nd parameter is the 'Saturation'; 255 => full saturation
}
FastLED.show();
}
And to actually answer your question, if you add
nblend( leds[0],leds[NUM_LEDS-1],64);
at the very end of the pride function, it smooths the transition from the first to last led and keeps the circle intact.
Playing with it a little more, if you declare hue8 as a global variable rather an a local one, and move the extra nblend function so that it immediately follows the original one, it looks better