/*
/    Lights NeoPixels on Circuit Playground
/    in sequence (LED chase, essentially)  
*/
#include <Adafruit_CircuitPlayground.h>
int R, G, B;

void setup() {
  CircuitPlayground.begin();
}

void loop() {
  R = random(0, 255);
  G = random(0, 255);
  B = random(0, 255);
// -> setPixelColor():
// 4 arguments: which NeoPixel (0-9), Red, Green, Blue (0-255)

//-- first, clear all pixel colors
  CircuitPlayground.clearPixels();

//-- Sequentially make each pixel the new random color  
  for (int i= 0; i < 10; i++) {
    CircuitPlayground.setPixelColor(i, R, G, B); 

//-- Make each trailing pixel after the random one green:
      if(i > 0){  
        CircuitPlayground.setPixelColor(i - 1, 0, 30, 0);
      }
      if(i == 9){
        CircuitPlayground.setPixelColor(i, 0, 30, 0);
      }
     delay(80);
  }
}
