count is set to 1
old_val is stored at index count which is 1
Then in the next loop, x is assigned to count which is 1
finally old_val[x-1] which is index 0 has a value stored in it.
This creates a bad value for the first led, and it typically flashes white.
for (int count = 1; count<NUM_PIXELS; count++) {
strip.setPixelColor(count, color);
old_val[count] = color;
for(int x = count; x>0; x--) {
old_val[x-1] = dimColor(old_val[x-1], width);
strip.setPixelColor(x-1, old_val[x-1]);
}
*** The FIX ***
start the count loop at 0 and decrement the comparison to NUM_PIXELS by 1.
for (uint16_t count = 0; count < NUM_PIXELS-1; count++)
countis set to1old_valis stored at indexcountwhich is1Then in the next loop,
xis assigned tocountwhich is1finally
old_val[x-1]which is index0has a value stored in it.This creates a bad value for the first led, and it typically flashes white.
for (int count = 1; count<NUM_PIXELS; count++) {strip.setPixelColor(count, color);old_val[count]= color;for(int x = count; x>0; x--) {old_val[x-1]= dimColor(old_val[x-1], width);strip.setPixelColor(x-1, old_val[x-1]);}*** The FIX ***
start the count loop at 0 and decrement the comparison to
NUM_PIXELSby 1.for (uint16_t count =0; count < NUM_PIXELS-1; count++)