   if(millis()>nextcall)
     on_off = false;
   forceRendering();
-  
+
+    
+  if(millis() > nextcall2){
+    nextcall2 += intervalperiod;
+    Serial.println(readJoystick());
+  }
   on_off ? set_position = xh + sin(10.0f*2.0f*M_PI*millis()/64000.0f) : force = 0;
   motorControl();
   

void calPosMeter()
{
  double rh = 65.659;   //[mm]
  double ts = -.0107 * updatedPos + 4.9513; // Compute the angle of the sector pulley (ts) in degrees based on updatedPos
  xh = rh * (ts * 3.14159 / 180); // Compute the position of the handle based on ts
  vh = -(.95 * .95) * lastLastVh + 2 * .95 * lastVh + (1 - .95) * (1 - .95) * (xh - lastXh) / .0001; // filtered velocity (2nd-order filter)
  lastXh = xh;

*/
bool dir;
uint32_t nextcall = 1000;
const uint16_t intervalperiod = 50*64; // 100 milliseconds
uint32_t nextcall2 = 1000;
bool on_off = true;
void loop() {
  // read the position in count
