   lsm.getEvent(&accel, &mag, &gyro, &temp);  
 }
 
+
 void dof_loop() {
   /* Get a new sensor event */
   sensors_event_t accel, mag, gyro, temp;

  lasttouched = currtouched;
}

void checkTouch() {
  for (uint8_t i=0; i < 12; i++) {
    // it if *is* touched and *wasnt* touched before, alert!
    if ( (currtouched & _BV(i)) && !(lasttouched & _BV(i)) ) touchHandler(i);

    // if it *was* touched and now *isnt*, alert!
    if ( !(currtouched & _BV(i)) && (lasttouched & _BV(i)) ) releaseHandler(i);
  } 
}

void touchHandler(int id) {
  Serial.print(id); Serial.println(" released");
}

void releaseHandler(int id) {
  Serial.print(id); Serial.println(" touched");
}

void calibrate(float x, float y) {
   xRange[0] = min(xRange[0], x);

   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;
}


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