+
+#include <FastLED.h>
+#include <pixeltypes.h>
+
 
 // Comment this out to entirely disable the motor control functions. Handy when testing and you
 // really don't want the robot to vanish off into the distance mid-test.

#endif

// Lights
Triangula_NeoPixel pixels = Triangula_NeoPixel();

void setup() {
  pixels.begin();
  Serial.begin(9600);
  Wire.begin(SLAVE_ADDRESS);
  Wire.onRequest(requestEvent);

  encoder_c = c;
}

void setSolidColour(int hue, int saturation, int value) {
  for (int pixel = 0; pixel < NUM_LEDS; pixel++) {
    leds[pixel] = CHSV(hue, saturation, value);
  }
}

// Set pylon colours based on speed
// wheelSpeed is 0-255, where 0 is full speed one way, 255 full speed the other
// pylon is [0,1,2] depending on which wheel we're creating the lighting for
void setColoursForWheelSpeed(int pylon, int wheelSpeed, int hue1, int hue2) {
  if (wheelSpeed >= 128) {
    int ledsLit = (wheelSpeed - 112) >> 4;
    for (int n = 0; n < 8; n++) {
      if (n <= ledsLit) {
        leds[pylon * 8 + n] = CHSV(hue1, 200, 200);
      }
      else {
        leds[pylon * 8 + n] = CHSV(0, 0, 0);
      }
    }
  }
  else {
    int ledsLit = (143 - wheelSpeed) >> 4;
    for (int n = 0; n < 8; n++) {
      if ((8 - n) <= ledsLit) {
        leds[pylon * 8 + n] = CHSV(hue2, 200, 200);
      }
      else {
        leds[pylon * 8 + n] = CHSV(0, 0, 0);
      }
    }
  }
}

