 #include <Adafruit_NeoPixel.h>
 #include <Bridge.h>
 #include <HttpClient.h>
+#include <math.h>
 
 /* NEO_RGB     Pixels are wired for RGB bitstream
  NEO_GRB     Pixels are wired for GRB bitstream


void setup() {
  Bridge.begin();  // make contact with the linux processor

  initLeds();
}

void initLeds(){
  
  strip.begin();
  strip.show();
}
void loop() {
  fadeSlow(r, g, b);
  Bridge.get("r", rChar, 256);
  Bridge.get("g", gChar, 256);
  Bridge.get("b", bChar, 256);
  r = atoi(rChar);
  g = atoi(gChar);
  b = atoi(bChar);
}

void fadeSlow(int r, int g, int b){
  time = millis();
  fadePixels(time, r, g, b);
}

void fadeFast(int r, int g, int b){
  time = millis()*50;
  fadePixels(time, r, g, b);
}

void fadePixels(int time, int r, int g, int b){

  }
  strip.show();
}


// t: current time, b: beginning value, c: change in value, d: duration
float linearTween (float t, float b, float c, float d) {
  return c*t/d + b;
}

float easeInOutSine (float t, float b, float c, float d) {
  return -c/2 * (cos(M_PI*t/d) - 1) + b;
}

float easeInBounce (float t, float b, float c, float d) {
  return c - easeOutBounce (d-t, 0, c, d) + b;
}

float easeOutBounce (float t, float b, float c, float d) {
  if ((t/=d) < (1/2.75)) {
    return c*(7.5625*t*t) + b;
  } else if (t < (2/2.75)) {
    return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
  } else if (t < (2.5/2.75)) {
    return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
  } else {
    return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
  }
}

float easeInOutBounce (float t, float b, float c, float d) {
  if (t < d/2){
    return easeInBounce (t*2, 0, c, d) * .5 + b;
  }
  return easeOutBounce (t*2-d, 0, c, d) * .5 + c*.5 + b;
}
