/* flash 3 Pixel LED strips randomly version 2
  www. steamtraininfo.com.
  This sketch uses 3
  WS2812B pixel strips.
*/

#include <FastLED.h>
#define NUM_LEDS 15 /*the number of leds that will light. If */
//****************************
#define DATA_PINA 8 // Connect to the data wires on the pixel strips
#define DATA_PINB 7
#define DATA_PINC 6

CRGB ledsA[NUM_LEDS]; // sets number of pixels that will light on each strip.
CRGB ledsB[NUM_LEDS];
CRGB ledsC[NUM_LEDS];

//*****************************************************

void setup() {
  FastLED.addLeds<WS2812B, DATA_PINA, GRB>(ledsA, NUM_LEDS);
  FastLED.addLeds<WS2812B, DATA_PINB, GRB>(ledsB, NUM_LEDS);
  FastLED.addLeds<WS2812B, DATA_PINC, GRB>(ledsC, NUM_LEDS);
  randomSeed(analogRead(A0)); /*sets the pin to create "static so the the initial LED to light is different
  each time through the loop  */
}

//********************************************************

void loop() {
  BlinkRandomly();
}

//**************************************************
void fillStrip(int number, const struct CRGB &color) {
  switch (number) {
    case 1:
    fill_solid(ledsA, NUM_LEDS, color);
    break;
    case 2:
    fill_solid(ledsB, NUM_LEDS, color);
    break;
    case 3:
    fill_solid(ledsC, NUM_LEDS, color);
    break;
  }
    FastLED.show();
}

//**************************************************
void BlinkRandomly() {
  int delayTime = random(25, 200);  // sets the blink rate in milliseconds
  int stripIndex = random(1, 4);
  fillStrip(stripIndex, CRGB::Red);
  delay(delayTime);
  fillStrip(stripIndex, CRGB::Black);
  delay(delayTime);
}