#include <FastLED.h>
#include <Wire.h>
// Number of LEDs in the first circle around the proximity sensor
#define NUM_LEDS_VISION_01 35
// Number of LEDs in the second circle around the photon vision camera
#define NUM_LEDS_VISION_02 35
// Number of LEDs in the first strip
#define NUM_LEDS_STRING_01 4
// TODO Make Mathes
#define NUM_LEDS_TOTAL 35
#define LED_PIN 2
#define I2C_ADDRESS 4
CRGB leds[NUM_LEDS_TOTAL];
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
void receiveEvent(int numberData) {
while (Wire.available() > 0) { // loop through all
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
}
void setup() {
Wire.begin(I2C_ADDRESS); // join i2c bus with address 4
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS_TOTAL);
FastLED.setBrightness(50);
}
void loop() {
for(int i = 0; i < NUM_LEDS_TOTAL; i++) {
Serial.print(i);
// Generate top eyelid
fill_solid(leds, i, CRGB::Red);
fill_solid(leds, i - 1, CRGB::Black);
FastLED.show();
delay(1000);
// Clear buffer
fill_solid(leds, NUM_LEDS_TOTAL, CRGB::Black);
}
}