     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;

double rh = 0.065659;   //[m]
// Force output variables
double force = 0;           // force at the handle
double force_vibrate = 0;
double Tp = 0;              // torque of the motor pulley
double duty = 0;            // duty cylce (between 0 and 255)
unsigned int output = 0;    // output command to the motor
