ibt2 dc motor controller

Hey, are there some body who know how to code a feedback potentiometer.
into the arduino code . so the ibt2 motor controller and Arduino behave like a non continues servo.
i now i have to mount a potentiometer to the motor.
I got the most of the code so ibt2 motor controller behave as a continues rotating servo.but i am not skilled enough
to wright that peace of code. to make it work as a non continues servo
the code is not written by me. i am a newbie to arduino. any how its still fun to do the wiring while learning.
the code is

/*
IBT-2 Motor Control Board driven by Arduino.

Speed and direction controlled by a potentiometer attached to analog input 0.
One side pin of the potentiometer (either one) to ground; the other side pin to +5V

Connection to the IBT-2 board:
IBT-2 pin 1 (RPWM) to Arduino pin 5(PWM)
IBT-2 pin 2 (LPWM) to Arduino pin 6(PWM)
IBT-2 pins 3 (R_EN), 4 (L_EN), 7 (VCC) to Arduino 5V pin
IBT-2 pin 8 (GND) to Arduino GND
IBT-2 pins 5 (R_IS) and 6 (L_IS) not connected
*/

int SENSOR_PIN = 0; // center pin of the potentiometer

int RPWM_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM)
int LPWM_Output = 6; // Arduino PWM output pin 6; connect to IBT-2 pin 2 (LPWM)

void setup()
{
  pinMode(RPWM_Output, OUTPUT);
  pinMode(LPWM_Output, OUTPUT);
}

void loop()
{
  int sensorValue = analogRead(SENSOR_PIN);

  // sensor value is in the range 0 to 1023
  // the lower half of it we use for reverse rotation; the upper half for forward rotation
  if (sensorValue < 512)
  {
    // reverse rotation
    int reversePWM = -(sensorValue - 511) / 2;
    analogWrite(LPWM_Output, 0);
    analogWrite(RPWM_Output, reversePWM);
  }
  else
  {
    // forward rotation
    int forwardPWM = (sensorValue - 512) / 2;
    analogWrite(LPWM_Output, forwardPWM);
    analogWrite(RPWM_Output, 0);
  }
}

and the wiring is like this attach file

Please use the "#" CODE TAGS toolbutton when you post code. (click the Modify button, highlight the code and click the "#" CODE TAGS button. and then click SAVE .

thanks we all have to learn

and the wiring is like this attach file

There is no file attached. To attach a file, click on the "Additional Options" button to open the browse folders window.

I don't know the answer to your question but it might help if you post a link for your motor controller. I am still not sure what kind of servo you are using. (continuous or non-continuous [position: (+/- 90 degrees)]