#include <FastLED.h>
#define LED_PIN 5
#define NUM_LEDS 50
#define BRIGHTNESS 64
#define LED_TYPE WS2811
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS);
}
void loop(){
CRGB colA = {255,32,96}; // this will ne the colour when blendval = 0
CRGB colB = {32,128,192}; // "" blendVal = 255
uint8_t blendVal; // this defines how much to blend between col a and col b (0-255)
blendVal = beat8(10); // Sawtooth wave at 10 bpm (pretty slow )
blendVal = ease8InOutApprox(blendVal); // this will slow the transition at either end, if you're into that
CRGB blendedCol = colA.lerp8(colB ,blendVal ); // create new interpolated CRGB obj from colA and ColB
FillLEDs (blendedCol);
FastLED.show();
}
void FillLEDs( CRGB newCol)
{
uint8_t brightness = 255;
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = newCol ;
}
}