#include "FastLED.h"
#include <Wire.h>

#define NUM_LEDS 6
#define DATA_PIN 6
#define SLAVE_ADDRESS 0x12

// Define the array of leds
CRGB leds[NUM_LEDS];

void setup() { 
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  Wire.begin(SLAVE_ADDRESS);
  Wire.onReceive(receiveData);
}

void loop() { 
  /*
  // Turn the LED on, then pause
  leds[0]   = CRGB::Red;
  FastLED.show();
  delay(500);
  // Now turn the LED off, then pause
  leds[0] = CRGB::Blue;
  FastLED.show();
  */
  delay(500);
}

void receiveData(int byteCount) {
  while(Wire.available()) {
    if (1 == Wire.read()) {
      leds[0]   = CRGB::Red;
      FastLED.show();
    } else {
      leds[0] = CRGB::Blue;
      FastLED.show();
    }
  }
}

/*
#include <Wire.h>

#define SLAVE_ADDRESS 0x12
#define PIN_LED 13
    #define NUM_LEDS 6
    #define DATA_PIN 6

// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, 6, NEO_GRB + NEO_KHZ800);

void setup() {
    Wire.begin(SLAVE_ADDRESS);
    Wire.onReceive(receiveData);
    pinMode(PIN_LED, OUTPUT);
    digitalWrite(PIN_LED, LOW);
    
strip.begin();// initialize strip
strip.show();                // Update all LEDs (= turn OFF, since none of them have been set yet!)
c = strip.Color(255, 0, 0);  // define the variable c as RED (R,G,B)
strip.setPixelColor(2, c);  // set LED 10 to the color in variable c (red)
strip.show();                // Update all LEDs (= make LED 10 red) 

}

void loop() {
    delay(10000);
}

void receiveData(int byteCount) {
    while(Wire.available()) {
	if (1 == Wire.read()) {
		digitalWrite(13, HIGH);
	} else {
		digitalWrite(13, LOW);
	}
    }
}
*/
