     analogWrite(D2, 0);
 }
  
-void motion(int lpwm, int rpwm, int llevel, int rlevel) {  
+void motion(double lpwm, double rpwm, int llevel, int rlevel) {  
     if (llevel==HIGH) {
       ldir=1; 
     } else {

  attachInterrupt(D5, lencode, CHANGE); // Setup Interrupt 
  attachInterrupt(D6, rencode, CHANGE); // Setup Interrupt 
  sei();                                // Enable interrupts  
  int currentTime = millis();
  int cloopTime = currentTime;
  os_timer_setfn(&myTimer, tic, NULL);
  os_timer_arm(&myTimer, period, true);   // timer in ms
  lPID.SetSampleTime(period);
  rPID.SetSampleTime(period); 
  tPID.SetSampleTime(period);  
  lPID.SetMode(AUTOMATIC);
  rPID.SetMode(AUTOMATIC);
  tPID.SetMode(AUTOMATIC);
  Serial.begin(115200);
  Serial.println("Ready");
}

    }
  } else {
    if (Serial.available() != 0) {
      int gv = Serial.parseInt();
      if(c=='s'){
        lSet=gv/10.;
        rSet=gv/10.;
