     Serial.print(" ");
     Serial.println(xh);
   }
-  on_off ? set_position = xh + amplitude * sin(vibrationfrequency*2.0f*M_PI*millis()/64000.0f) : force = 0;
+
+
+  // calculations for haptic event feedback
+  on_off ? force_vibrate = amplitude * sin(vibrationfrequency*2.0f*M_PI*millis()/64000.0f) : force_vibrate = 0;
+  
   motorControl();
-  
 }
 
 /*

  static float last_error = 0.0f;
  static float I = 0.0f;

  static float kP = 0.2f;
  static float kI = 0.0f;
  static float kD = 0.00004f;

  const float MAX_DIFFERENCE = 0.0f;
  const float LIMITPLUS = 1.0f;

  //TODO the reading and decoding goes here

  if (fbEvent.startsWith("FB")) {
	springfactor = atof(fbEvent.substring(3).c_str()); // roughly from 0 to 1000
    //Serial.print("force: ");
    //Serial.println(force);
  } else if (fbEvent.startsWith("HitCar")) {
	shake(500, 100.0f, 0.1f);
  } else if (fbEvent.startsWith("Creak")) {
    shake(500, 100.0f, 0.1f);
  } else if (fbEvent.startsWith("Smash")) {
	shake(500, 100.0f, 0.5f);
  } else if (fbEvent.startsWith("Wreck")) {
	shake(500, 200.0f, 0.1f);
  } else if (fbEvent.startsWith("Offroad")) {
	shake(500, 20.0f, 0.1f);
  } else if (fbEvent.startsWith("Grounded")) {
	shake(200, 10.0f, 0.1f);
  }
}

