  *     functions may also be affected.
  *   - Changes on pins 9 or 10 will cause the Servo library to function
  *     incorrectly.
- * 
+ *
  * Thanks to macegr of the Arduino forums for his documentation of the
  * PWM frequency divisors. His post can be viewed at:
  *   http://forum.arduino.cc/index.php?topic=16612#msg121031

  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) < DEADBAND )
    PWM_L = 0;
  if( abs(PWM_R) < DEADBAND )
    PWM_R = 0;

  int dirL = PWM_L < 0;
  int dirR = PWM_R > 0;

  int powerL = dirL ? 255 + PWM_L : PWM_L;
  int powerR = dirR ? 255 - PWM_R : -PWM_R;
  
  if(desiredSpeedL == 0)
    PWM_L = 0;
  if(desiredSpeedR == 0)
    PWM_R = 0;
  
  digitalWrite(rightDir, dirR);
  digitalWrite(leftDir, dirL);
  analogWrite(rightSpeed, powerR);
  analogWrite(leftSpeed, powerL);
  
  lastErrorL = ErrorL;
  lastErrorR = ErrorR;
}

{
  if (digitalRead(encoderLeftData1) == digitalRead(encoderLeftData2))
  {
	tickDataLeft++;
  }
  else
  {
	tickDataLeft--;
  }
}

/**
 * Divides a given PWM pin frequency by a divisor.
 *
 * The resulting frequency is equal to the base frequency divided by
 * the given divisor:
 *   - Base frequencies:
