#include <FastLED.h>

#define LED_PIN     2
#define NUM_LEDS    8

CRGB leds[NUM_LEDS];

void setup() {

  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  
}

int rLed = 0;
int d = 350;
int r = 0;
int g = 0;
int b = 0;



void loop() {

while(true){
 for(byte n = 0; n<256; n++){
  for(byte b = 0; b<NUM_LEDS; b++){
    if(n & (1 << b)){
      leds[b] = CRGB(255,0,0);
      FastLED.show();
      
    }else{
      leds[b] = CRGB(0,0,0);
      FastLED.show();

    }
  }
  delay(d);
  //fill_solid(leds, NUM_LEDS, CRGB(0,0,0));
 // FastLED.show();
 }

}



  // put your main code here, to run repeatedly:
  //for(int lp=0; lp<3; lp++){
  //for(int i=0; i<255; i+=5){
  //fill_solid( leds, NUM_LEDS, CRGB(i,0,0));
  //leds[0] = CRGB(i,0,0);
  //FastLED.show();
  //delay(d);  
  //}

  
  
 
 // for(int i = 255; i>=0; i-=5){
  //	 fill_solid( leds, NUM_LEDS, CRGB(i,0,0));
    //leds[0] = CRGB(i,0,0);
   // FastLED.show();
  //  delay(d);
  ////}
  //}

  //for(int n =0; n<NUM_LEDS; n++){
   // leds[n] = CRGB(255,0,0);
   // FastLED.show();
   // delay(d);
 // }

 for(int lp=0; lp<NUM_LEDS;){
  r = random(0,255);
  g = random(0,255);
  b = random(0,255);

  for(int  n=NUM_LEDS; n>=0; n--){
    leds[n] = CRGB(255,0,0);
    leds[n-1] = CRGB(0,0,255);
    FastLED.show();
    delay(d);
    leds[n] = CRGB(0,0,0);
    FastLED.show();
    delay(d);
  }

  for(int n=0; n<NUM_LEDS; n++){
    leds[n] = CRGB(255,255,255);
    FastLED.show();
    delay(d);
    leds[n] = CRGB(0,0,0);
    FastLED.show();
    delay(d);
  }
 }


for(int n=0; n<NUM_LEDS; n++){
  for(int i=0; i<6; i++){
    leds[n] = CRGB(255,255,255);
    FastLED.show();
    delay(d);
    leds[n] = CRGB(0,0,0);
    FastLED.show();
    delay(d);
  }
  delay(d*3);
}


for(int n=0; n<NUM_LEDS*5; n++){
rLed = random(NUM_LEDS);


r = random(0,255);
g = random(0,255);
b = random(0,255);
leds[rLed] = CRGB(r,g,b);
  FastLED.show();
  delay(d*3);
leds[rLed] = CRGB(0,0,0);
FastLED.show();
delay(d*3);
}







for (int r1=0; r1<6; r1++){



r = random(0,255);
g = random(0,255);
b = random(0,255);
for(int n = 0; n<NUM_LEDS; n++){
  leds[n] = CRGB(r,g,b);
  FastLED.show();
  delay(d*3);
}
for(int n = 0; n<NUM_LEDS; n++){
  leds[n] = CRGB(0,0,0);
  FastLED.show();
  delay(d*3);
}

for(int n = NUM_LEDS ; n>=0; n--){
  leds[n] = CRGB(r,g,b);
  FastLED.show();
  delay(d*3);
}

for(int  n = NUM_LEDS; n>=0; n--){
  leds[n] = CRGB(0,0,0);
  FastLED.show();
  delay(d*3);
}

}

}