#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);
}
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
ring1:GND
ring1:VCC
ring1:DIN
ring1:DOUT
ring2:GND
ring2:VCC
ring2:DIN
ring2:DOUT