When I find this happening to me, if it is not an out-of-array-bounds value, then the (in-bounds) pixel value of less than 0 or greater than 255 will cause a "blink/flash"
The "< or > value" occurs most when I am using an incrementing statement to cause another value to decrement (the reds increment causing blue to decrement, and vice versa).
This is my result for smooth red-mag-cyn-blu-cyn-mag-red transition.
#include <FastLED.h>
#define DATA_PIN 4
#define NUM_LEDS 299
#define COLOR_ORDER GRB
#define MAX_BRIGHT 128
CRGB leds[NUM_LEDS];
unsigned long timer, timeout = 10; // regulate color step change
int red = 1, grn, blu, dir = 1, buttonPin = 2;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
FastLED.addLeds<WS2812, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness(MAX_BRIGHT);
while(digitalRead(buttonPin)) {}; // wait for button press LOW
}
void loop() {
runSAMD21();
}
void runSAMD21() {
if (millis() - timer > timeout) { // control when each color change occurs
timer = millis(); // reset timer for next color change
red += dir; // inc/dec red color value
if (red == 0 || red == 255) { // when color value is at a boundary...
dir = -dir; // ... change direction
}
blu = 255 - red; // complement red color value for blue
for (int i = 0; i < NUM_LEDS; i++) { // count through all pixels
leds[i] = CRGB(red, grn, blu); // update buffer for all pixels
}
FastLED.show(); // show new color
}
}