 */
 
 /* Assign a unique base ID for this sensor */
-Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1000);  // Use I2C, ID #1000
+
+// 9DOF
+Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1005);  // Use I2C, ID #1000
 #define LSM9DS0_XM_CS 10
 #define LSM9DS0_GYRO_CS 9
 #define LSM9DS0_SCLK 13

    mx = map(accel.acceleration.y - yNormal, -20, 20, 200, -200);
  }
  Mouse.move(mx, my, 0);

//  print out accelleration data
//  Serial.print("Accel X: "); Serial.print(accel.acceleration.x); Serial.print(" ");
//  Serial.print("  \tY: "); Serial.print(accel.acceleration.y);   Serial.print(" ");
//  Serial.print("  \tZ: "); Serial.print(accel.acceleration.z);   Serial.println("  \tm/s^2");
//  Serial.print("Magn. X: "); Serial.print(mag.magnetic.x); Serial.print(" ");
//  Serial.print("  \tY: "); Serial.print(mag.magnetic.y);       Serial.print(" ");
//  Serial.print("  \tZ: "); Serial.print(mag.magnetic.z);     Serial.println("  \tgauss");
//  Serial.print("Gyro  X: "); Serial.print(gyro.gyro.x); Serial.print(" ");
//  Serial.print("  \tY: "); Serial.print(gyro.gyro.y);       Serial.print(" ");
//  Serial.print("  \tZ: "); Serial.print(gyro.gyro.z);     Serial.println("  \tdps");
//  Serial.print("Temp: "); Serial.print(temp.temperature); Serial.println(" *C");

  delay(10);
}

void calibrate(float x, float y) {

   
   Serial.print(xRange[0]); Serial.print(", "); Serial.println(xRange[1]);
   Serial.print(yRange[0]); Serial.print(", "); Serial.println(yRange[1]);
}

//template<typename T>
//T clamp(T Value, T Min, T Max) {
//  return (Value < Min)? Min : (Value > Max)? Max : Value;
//}


void displaySensorDetails(void) {
  sensor_t accel, mag, gyro, temp;

  lsm.getSensor(&accel, &mag, &gyro, &temp);

  Serial.println(F("------------------------------------"));
  Serial.print  (F("Sensor:       ")); Serial.println(accel.name);
  Serial.print  (F("Driver Ver:   ")); Serial.println(accel.version);
  Serial.print  (F("Unique ID:    ")); Serial.println(accel.sensor_id);
  Serial.print  (F("Max Value:    ")); Serial.print(accel.max_value); Serial.println(F(" m/s^2"));
  Serial.print  (F("Min Value:    ")); Serial.print(accel.min_value); Serial.println(F(" m/s^2"));
  Serial.print  (F("Resolution:   ")); Serial.print(accel.resolution); Serial.println(F(" m/s^2"));
  Serial.println(F("------------------------------------"));
  Serial.println(F(""));

  Serial.println(F("------------------------------------"));
  Serial.print  (F("Sensor:       ")); Serial.println(mag.name);
  Serial.print  (F("Driver Ver:   ")); Serial.println(mag.version);
  Serial.print  (F("Unique ID:    ")); Serial.println(mag.sensor_id);
  Serial.print  (F("Max Value:    ")); Serial.print(mag.max_value); Serial.println(F(" uT"));
  Serial.print  (F("Min Value:    ")); Serial.print(mag.min_value); Serial.println(F(" uT"));
  Serial.print  (F("Resolution:   ")); Serial.print(mag.resolution); Serial.println(F(" uT"));
  Serial.println(F("------------------------------------"));
  Serial.println(F(""));

  Serial.println(F("------------------------------------"));
  Serial.print  (F("Sensor:       ")); Serial.println(gyro.name);
  Serial.print  (F("Driver Ver:   ")); Serial.println(gyro.version);
  Serial.print  (F("Unique ID:    ")); Serial.println(gyro.sensor_id);
  Serial.print  (F("Max Value:    ")); Serial.print(gyro.max_value); Serial.println(F(" rad/s"));
  Serial.print  (F("Min Value:    ")); Serial.print(gyro.min_value); Serial.println(F(" rad/s"));
  Serial.print  (F("Resolution:   ")); Serial.print(gyro.resolution); Serial.println(F(" rad/s"));
  Serial.println(F("------------------------------------"));
  Serial.println(F(""));

  Serial.println(F("------------------------------------"));
  Serial.print  (F("Sensor:       ")); Serial.println(temp.name);
  Serial.print  (F("Driver Ver:   ")); Serial.println(temp.version);
  Serial.print  (F("Unique ID:    ")); Serial.println(temp.sensor_id);
  Serial.print  (F("Max Value:    ")); Serial.print(temp.max_value); Serial.println(F(" C"));
  Serial.print  (F("Min Value:    ")); Serial.print(temp.min_value); Serial.println(F(" C"));
  Serial.print  (F("Resolution:   ")); Serial.print(temp.resolution); Serial.println(F(" C"));
  Serial.println(F("------------------------------------"));
  Serial.println(F(""));

  delay(500);
}
