/* What I need is a way to write array BGR (yes reversed order due to how installed
on board) but I need from off to start blending on function until all leds's lit
at 100%.
Start with B0... G0....R0....B1,G1,R1,B2,R2,G2.... and so on, until all lit and
will stay on, no more effects. All this blended if possible from B to G to R to
B1 to R1 to G1...etc...
*/
#include <FastLED.h>
#define NUM_LEDS 24
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, PB1, BGR>(leds, NUM_LEDS);
FastLED.clear(1);
}
void loop() {
// smaller numbers give wider waves
uint16_t waveslope = 2000;
// speed in 1/256ths of a pixel per frame
uint16_t wavespeed = 100;
// position of start up "wave" at power up
static int32_t wavepos = 0;
// to allow addressing of each element of the WWW LEDs individually:
byte * whiteleds = (byte *) leds;
// accumulate the wave along the strip of LEDs
int32_t ledpos = wavepos;
for (uint16_t ledno = 0; ledno < NUM_LEDS * 3; ledno++) {
// clamp the brightness to the range 0-255
uint8_t brightness = 0;
if (ledpos > 0) {
brightness = ledpos < 65535 ? ledpos / 256 : 255;
}
whiteleds[ledno] = brightness;
ledpos -= waveslope;
}
FastLED.show();
// move the wave position by some amount until the last LED is fully lit
if (whiteleds[NUM_LEDS * 3 - 1] != 255) {
wavepos += wavespeed;
} else {
delay(1000);
}
}