 void mpr_setup() {
   // needed to keep leonardo/micro from starting too fast!
   while (!Serial);
-
-  Serial.begin(9600);
-  Serial.println("Adafruit MPR121 Capacitive Touch sensor test"); 
+  Serial.begin(9600);    Serial.println("Adafruit MPR121 Capacitive Touch sensor test"); 
   
   // Default address is 0x5A, if tied to 3.3V its 0x5B
   // If tied to SDA its 0x5C and if SCL then 0x5D
-  if (!cap.begin(0x5A)) {
-    Serial.println("MPR121 not found, check wiring?");
-    while (1);
-  }
-  Serial.println("MPR121 found!");
+  if (!cap.begin(0x5A))  Serial.println("MPR121 not found");
+  else                   Serial.println("MPR121 found!");
 }
 
 

}


void calibrate(float x, float y) {
   xRange[0] = min(xRange[0], x);
   xRange[1] = max(xRange[1], x);
   
   yRange[0] = min(yRange[0], y);
   yRange[1] = max(yRange[1], y);
   
   xNormal = (xRange[0] + xRange[1])/2;
   yNormal = (yRange[0] + yRange[1])/2;
   
   Serial.print(xRange[0]); Serial.print(", "); Serial.println(xRange[1]);
   Serial.print(yRange[0]); Serial.print(", "); Serial.println(yRange[1]);
}


float clamp(float value, float min_, float max_) {
  return (value < min_) ? min_ : (value > max_) ? max_ : value;
}


// Configures the gain and integration time for the TSL2561
void configureSensor(void) {
  // Set the accelerometer range
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_2G);
  lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_4G);
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_6G);
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_8G);
  //lsm.setupAccel(lsm.LSM9DS0_ACCELRANGE_16G);

  // Set the magnetometer sensitivity
  lsm.setupMag(lsm.LSM9DS0_MAGGAIN_2GAUSS);
  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_4GAUSS);
  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_8GAUSS);
  //lsm.setupMag(lsm.LSM9DS0_MAGGAIN_12GAUSS);

  // Setup the gyroscope
  lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_245DPS);
  //lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_500DPS);
  //lsm.setupGyro(lsm.LSM9DS0_GYROSCALE_2000DPS);
