JustPaste.it

#include <FastLED.h>
 #define LEDPIN     7 
 #define NUMOFLEDS    10 
 CRGB leds[NUMOFLEDS]; 
 void setup() { 
  FastLED.addLeds<WS2812, LEDPIN, GRB>(leds, NUMOFLEDS); 
}
 void loop() { 
 for (int i = 0; i <= 9; i++) {
    leds[i] = CRGB ( 0, 0, 255);
    FastLED.show();
    delay(40);
  }
  for (int i = 9; i >= 0; i--) {
    leds[i] = CRGB ( 255, 0, 0);
    FastLED.show();
    delay(40);
  }
}