Hi. All..
Hope someone give the solution.
How to make color palette flow through ledarray In fillpalette function?
Thank you.
#include <FastLED.h>
#define LED_PIN 3 //STRIP SETUP
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
#define NUM_LEDS 20
#define BRIGHTNESS 75
#define FRAMES_PER_SECOND 120
#define line_segment 5 //STRIP CONTROL
#define led_per_segment 2
CRGB rawleds[NUM_LEDS];
CRGBSet leds(rawleds, NUM_LEDS);
CRGBSet seg0(leds(0,1));
CRGBSet seg1(leds(2,3));
CRGBSet seg2(leds(4,5));
CRGBSet seg3(leds(6,7));
CRGBSet seg4(leds(8,9));
struct CRGB*ledsarray[]={seg0,seg1,seg2,seg3,seg4};
uint8_t paletteIndex =0;
uint8_t x =0;
uint8_t hue=0;
uint8_t maxhue=255;
CRGBPalette16 currentPalette = RainbowColors_p;
TBlendType currentBlending = LINEARBLEND;
void setup() {
LEDS.delay(3000);
FastLED.setBrightness(BRIGHTNESS);
FastLED.addLeds<LED_TYPE, LED_PIN,COLOR_ORDER>(leds, 0, NUM_LEDS).setCorrection(TypicalLEDStrip);
}
void loop(){
//sinelon_line_segment();
fillpalette();
LEDS.show();
LEDS.delay(1000/FRAMES_PER_SECOND);
}
void fillpalette() {
for(x=0; x<line_segment; x++){
leds[ledsarray[x]]=ColorFromPalette( currentPalette, paletteIndex, 255, currentBlending);
//fill_palette(ledsarray[x], led_per_segment, paletteIndex, 255 / NUM_LEDS, currentPalette, 255, currentBlending);
}
EVERY_N_MILLISECONDS(10){
paletteIndex +=10; }
LEDS.show();
}
void sinelon_line_segment() {
fadeToBlackBy( leds, NUM_LEDS, 5);
for(int i=0; i<line_segment; i++){
int pos = beatsin16(10,0,line_segment);
fill_solid(ledsarray[pos],led_per_segment, CHSV( hue, 255, 255));
}
EVERY_N_MILLISECONDS(50) {
hue++;
if(hue>maxhue){hue = 0;} }
}