I'm working on a code based on PaletteCrossfade.ino example. But I found the motion speed too fast. It's stated in this:
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* motion speed */
FillLEDsFromPaletteColors(startIndex);
FastLED.show();
FastLED.delay(1000 / UPDATES_PER_SECOND);
}
void FillLEDsFromPaletteColors( uint8_t colorIndex) {
uint8_t brightness = 255;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex + sin8(i*16), brightness);
colorIndex += 3;
Since the startIndex defined in uint8_t
, it cant be lower than 1. So I used float and set it to 0.2 in my code. Which seems to work, and animation slowed down. However I'm not sure how is that float value added into the ColorFromPalette
function.
CRGB ColorFromPalette (const CRGBPalette16 &pal, uint8_t index, uint8_t brightness=255, TBlendType blendType=LINEARBLEND)
To my understanding it accepts only integer, and also int based sin8 being added to float value. So, what exactly happens there? Is this method viable, or is there any better way to slow down the animation?
I'm thinking about adding a millis() based delay and only increasing the colorindex every 2-3 seconds or so.
UPDATES_PER_SECOND
?FastLED.delay(1000 / UPDATES_PER_SECOND);
toFastLED.delay(1000);
and tell me what happens or change#define UPDATES_PER_SECOND 100
to#define UPDATES_PER_SECOND 1