Hi all,
I've got a working sketch running 8 one meter strips of DotStars with the FastLED library. The sketch largely does what I want in shifting colors through the strips. What I'm hoping to accomplish is a more gradual gradient in the color change. Right now the color blend from pixel to pixel is rather stark. The green shifts gradually to yellow, but then it sharply turns off in favor of red. I would like to find a way to change that so that it is a slow process that is stretched out over a greater number of pixels.
This line controls the length of each color segment, but not the blend. Ideally I would also be able to make the segment much, much larger. Currently the segment might be around 160 pixels or more. It's a little hard to count with the way I have it laid out. But If I could make the sketch give me one gradient from the first pixel to the last, that would be great.
colorIndex += 1;
I know that the multiplier I'm using in declaring each strip is also affecting the way the color is dispersed. Right now I am moderately happy with what I have, but I assume that would have to change if I could lengthen the color segment.
At the moment I am more concerned with increasing the blend to a more subtle pattern. After searching about on FastLED references, I've not seen a way to edit the blend function. Is it even possible?
Thanks again in advance!
#include "FastLED.h"
#define NUM_STRIPS 8
#define NUM_LEDS_PER_STRIP 60
#define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS
#define BRIGHTNESS 64
#define LED_TYPE APA102 // DotStar chipset
// #define COLOR_ORDER GRB
#define COLOR_ORDER BGR // DotStar color order
CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];
CRGBPalette32 currentPalette;
TBlendType currentBlending;
#define UPDATES_PER_SECOND 100
void setup() {
FastLED.addLeds<DOTSTAR, 30, 40>(leds, 0 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 31, 41>(leds, .25 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 32, 42>(leds, .5 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 33, 43>(leds, .75 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 34, 44>(leds, 1 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 35, 45>(leds, 1.25 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 36, 46>(leds, 1.5 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
FastLED.addLeds<DOTSTAR, 37, 47>(leds, 1.75 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP);
delay( 3000 ); // power-up safety delay
FastLED.addLeds<LED_TYPE, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
currentPalette = RainbowColors_p;
}
void loop() {
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* motion speed */
FillLEDsFromPaletteColors( startIndex);
FastLED.show();
FastLED.delay(5000 / UPDATES_PER_SECOND); // Scroll speed in milliseconds
}
void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
uint8_t brightness = 10; //preference is 4 but lower than 50 causes noticeable fragmentation
for(int i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 1; // Color segment size
}
}