   digitalWrite(encoderLeftData1,  HIGH);
   digitalWrite(encoderLeftData2,  HIGH);
 
-  pinMode(rightDir, OUTPUT);
-  pinMode(rightSpeed, OUTPUT);
+  pinMode(rightForwardSpeed, OUTPUT);
+  pinMode(rightBackwardSpeed, OUTPUT);
   pinMode(rightDisable, OUTPUT);
-  pinMode(leftDir, OUTPUT);
-  pinMode(leftSpeed, OUTPUT);
+  pinMode(leftForwardSpeed, OUTPUT);
+  pinMode(leftBackwardSpeed, OUTPUT);
   pinMode(leftDisable, OUTPUT);
   attachInterrupt(1, tickRight, CHANGE);
   attachInterrupt(0, tickLeft, CHANGE);

{
  if (digitalRead(encoderRightData1) == digitalRead(encoderRightData2))
  {
    tickDataRight++;
  }
  else
  {
    tickDataRight--;
  }
}


  int dPWM_R = (int)( P_r * ErrorR + D_r * dErrorR );

  PWM_L += dPWM_L;
  PWM_R += dPWM_R;

  PWM_L = min(255, max(-255, PWM_L) );
  PWM_R = min(255, max(-255, PWM_R) );

  // Deadband
  if( abs(PWM_L) < 0 )
	PWM_L = 0;
  if( abs(PWM_R) < 0 )
	PWM_R = 0;

  if(PWM_L < 0) {
	analogWrite(leftForwardSpeed, 0);
	analogWrite(leftBackwardSpeed, -PWM_L);
  } else {
	analogWrite(leftForwardSpeed, PWM_L);
	analogWrite(leftBackwardSpeed, 0);
  }

  /*if(PWM_R < 0) {
	analogWrite(rightForwardSpeed, 0);
	analogWrite(rightBackwardSpeed, 255);
  } else {
	analogWrite(rightForwardSpeed, 255);
	analogWrite(rightBackwardSpeed, 0);
  }*/
  analogWrite(rightForwardSpeed, 100);
  analogWrite(rightBackwardSpeed, 0);

  lastErrorL = ErrorL;
  lastErrorR = ErrorR;
}
