#include "FastLED.h"
#include <Adafruit_NeoPixel.h>
#define NUM_LEDS 48
CRGB leds[NUM_LEDS];
#define PIN 23

void setup()
{
  Serial.begin(9600);
  FastLED.addLeds<WS2812, PIN, RGB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}

void loop() {
  mySparkle(0xff, 0xff, 0xff, 100);
  //leds[1] = CRGB::Red;
  //leds[2] = CRGB::Blue;
  //leds[3] = CRGB::Green;  
  //FastLED.show(); 
}

void mySparkle(byte red, byte green, byte blue, int SpeedDelay) {
  int Pixel = random(NUM_LEDS);
  
  Serial.print("Pixel value is ");
  Serial.println(Pixel);

  leds[Pixel] = CRGB::White;
  //FastLED.show();
  showStrip();

  delay(SpeedDelay);

  leds[Pixel] = CRGB::Black;
  //FastLED.show();
  showStrip(); 
}


void Sparkle(byte red, byte green, byte blue, int SpeedDelay) {
  int Pixel = random(NUM_LEDS);
  setPixel(Pixel,red,green,blue);
  showStrip();
  delay(SpeedDelay);
  setPixel(Pixel,0,0,0);
}

void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
   // FastLED
   FastLED.show();
   Serial.println("Called show ...");
 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifndef ADAFRUIT_NEOPIXEL_H
   // FastLED
   leds[Pixel].r = red;
   leds[Pixel].g = green;
   leds[Pixel].b = blue;
 #endif
}

void setAll(byte red, byte green, byte blue) {
  for(int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
  }
  showStrip();
}