     ct++;
     
     static char string[300];
+    
     //compile output
     sprintf(string, "%d,%d,%f,%f,%f,%f,%f,%f,%f,%f,%f",ct,loop_time,imu.roll,imu.pitch,imu.yaw,imu.ax,imu.ay,imu.az,getVal(1, ANGLE),getVal(2, ANGLE),getVal(3, ANGLE));
   

#define LOOP_LOGGING 0
//1: enable logging in loop
//0: disable logging in loop

#define RUN_MOTORS 1

#define MAX_FREQUENCY 50
const long MIN_LOOP_TIME = 1000/MAX_FREQUENCY;

  return rad * 360.0/(2.0*PI/360);
}

float rollover(float* prev, float* mod, float value) {
  float margin = 50;

  //rollover 0
  if(*prev - margin < 0 && value + margin > 360.0){
    *mod = *mod - 360.0;
  }

  //rollover 360
  if(*prev + margin > 360.0 && value - margin < 0.0) {
    *mod = *mod + 360.0;
  }
  *prev = value;
  return value + *mod;
}

void setup() {
