hI all, im start make pattern effect using fastled,
Pattern effect like this
my problem is pixels don't start from pixel 0, and don't stop in the Center.
what i want is Red and yellow color fill to center after dot effect and finished in center.
hope someone can help. Thank you
#include <FastLED.h>
#define LEDPIN 7
#define COLOR_ORDER GRB
#define LED_TYPE WS2812B
#define NUM_LEDS 32
uint8_t BRIGHTNESS = 100;
int sp_1 = 30;
int sp_2 = 50;
CRGB leds[NUM_LEDS];
void setup() {
LEDS.delay(2000);
FastLED.addLeds<LED_TYPE,LEDPIN,COLOR_ORDER>(leds,NUM_LEDS);
FastLED.setBrightness(BRIGHTNESS);
}
void loop(){
stack_m();
}
/* PROBLEM :
GREEN SIDE NOT START FROM PIXEL0 & YELLOW SIDE NOT FINISHED ON CENTER*/
void stack_m(){
byte a = NUM_LEDS/2; //16
byte b = 0;
for (int c = 0; c < NUM_LEDS/2; c++){
a--;
b++;
for ( int i=b; i< NUM_LEDS-b; i++){ //dot from pixel 0++ to right--
for ( int o=0; o<=b; o++) { //fill green side from pixel 0 to center
leds[o] = CRGB::Green;
}
leds[i] = CRGB::Red;
LEDS.show();
LEDS.delay(sp_1);
leds[i]=CRGB::Black;
}
//------------------------------------
for ( int s= NUM_LEDS-b; s >= b; s--) { //dot from last pixel-- to first++
for ( int o=NUM_LEDS; o> NUM_LEDS-b; o--){ //fill Blue side from last pixel to center
leds[o] = CRGB::Yellow;
}
leds[s] = CRGB::Blue;
LEDS.show();
LEDS.delay(sp_1);
leds[s]=CRGB::Black;
}
}
}