#include <FastLED.h>
CRGB leds[16];
int i, x, a;
void setup() {
FastLED.addLeds<WS2812, 14,GRB>(leds, 16);
}
void loop() {
for(i=0;i<=16;i++){
if(i<=2 && i>0){
for(a=0;a<i;a++){
leds[a]=CRGB(255, 0, 0);
FastLED.show();
}
}
else if(i<=8 && i>2){
for(a=0;a<i;a++){
leds[a]=CRGB(255, 255, 0);
FastLED.show();
}
}
else if(i<=16 && i>8){
for(a=0;a<i;a++){
leds[a]=CRGB(0, 255, 0);
FastLED.show();
}
}
delay(250);
}
for(i=15;i>=0;i--){
leds[i]=CRGB(0, 0, 0);
FastLED.show();
if(i<=15 && i>8){
for(x=0;x<i;x++){
leds[x]=CRGB(0, 255, 0);
FastLED.show();
}
}
else if(i<=8 && i>2){
for(x=0;x<i;x++){
leds[x]=CRGB(255, 255, 0);
FastLED.show();
}
}
else if(i<=2 && i>0){
for(x=0;x<i;x++){
leds[x]=CRGB(255, 0, 0);
FastLED.show();
}
}
delay(500);
}
}