// ArrayOfLedArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on
// using multiple controllers.  In this example, we're going to set up three NEOPIXEL strips on three
// different pins, each strip getting its own CRGB array to be played with, only this time they're going
// to be all parts of an array of arrays.

#include <FastLED.h>

#define NUM_STRIPS 3
#define NUM_LEDS 30
CRGB leds[NUM_LEDS];

// For mirroring strips, all the "special" stuff happens just in setup.  We
// just addLeds multiple times, once for each strip
void setup() {
  // tell FastLED there's 30 NEOPIXEL leds on pin 10
  FastLED.addLeds<NEOPIXEL, 10>(leds, NUM_LEDS);

  // tell FastLED there's 30 NEOPIXEL leds on pin 11
 // FastLED.addLeds<NEOPIXEL, 11>(leds[1], NUM_LEDS_PER_STRIP);

  // tell FastLED there's 30 NEOPIXEL leds on pin 12
//  FastLED.addLeds<NEOPIXEL, 12>(leds[2], NUM_LEDS_PER_STRIP);

}
CRGBPalette16 purplePalette = CRGBPalette16 (
    CRGB::GreenYellow,
    CRGB::Chartreuse,
    CRGB::DeepPink,
    CRGB::OrangeRed,
    
    CRGB::Magenta,
    CRGB::Magenta,
    CRGB::Linen,
    CRGB::Linen,
    
    CRGB::Magenta,
    CRGB::Magenta,
    CRGB::DarkViolet,
    CRGB::DarkViolet,

    CRGB::DarkViolet,
    CRGB::DarkViolet,
    CRGB::Linen,
    CRGB::Linen
);


CRGBPalette16 myPal = purplePalette;

void loop() {
  // This outer loop will go over each strip, one at a time

// EVERY_N_MILLISECONDS(60){
    //Switch on an LED at random, choosing a random color from the palette
//    leds[random8(0, NUM_LEDS - 1)] = ColorFromPalette(myPal, random8(), 255, LINEARBLEND);
//  }

   // Fade all LEDs down by 1 in brightness each time this is called
//   fadeToBlackBy(leds, NUM_LEDS, 1);
  
//  FastLED.show();

  //for(int x = 0; x < NUM_LEDS; x++) {
    // This inner loop will go over each led in the current strip, one at a time
    uint8_t beat1 = beatsin8(30, 0, NUM_LEDS-1,0,0);
     uint8_t beat2 = beatsin8(30, 0, NUM_LEDS-1,0,64);
     uint8_t beat3 = beatsin8(30, 0, NUM_LEDS-1,0,127);

  //  leds[beat1] = CRGB::Red;
//leds[beat2] = CRGB::Green;
//leds[beat3] = ColorFromPalette(myPal, random8(), 255, LINEARBLEND);//CRGB::Blue;
 
 fill_rainbow(leds,NUM_LEDS,(beat1+beat2)/2,8);

    fadeToBlackBy(leds, NUM_LEDS, 5);
     FastLED.show();
     //delay(100);
    /*for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
      leds[x][i] = CRGB::Red;
      FastLED.show();
      leds[x][i] = CRGB::Black;
      delay(100);
    }*/
  //}
}