Looking for some help in stopping this motorized potentiometer midway

hello there, sorry i cant even open any of your zip file, maybe its my computer.
int lineTrack = 5;    //line track for position reading the 5 need to change to A5. anyway i got an idea, to reduce the programming in arduino part.

lets see maybe in the processing part you could send a serial data maybe A,B and C

if A receive the motor will move to position 0
if B receive the motor will move to position 1
if C receive the motor will move to position 2

and the list could expend as you seem fit.

now in arduino

lets say if arduino receive an A= 0
then it will move to position to where the pot is 0
let say if arduino receive a B = 512
then it will move to position to where the pot is 512
lets say if arduino receive a c = 1023
then it will move to position to where the pot is 1023

lets try to program the arduino

const int Pot     = A0;  //Set the Linear Pot middle pin to Arduino A0 port
const int Enable =  2;  //Set the Motor controller pin on pin 2 Arduino  
const int A1      =  3;  //Set the Motor Controller pin A1 to port 3;
const int A2      =  4;  //Set the Motor Controller pin A2 to port 4; 
int Target        =  0;  //Target is the position we want the motor to move to 
int Speed         =  0;  //Speed Control for motor
void setup()
{
 pinMode (Pot,INPUT);          //Set Pot as Input  
 pinMode (Enable,OUTPUT);  //Set Enable as Output
 pinMode (A1,OUTPUT);       //Set A1 as Output
 pinMode (A2,OUTPUT);       //Set A2 as Output
 Serial.begin(9600);             //Initialize Serial Communication at 9600 baud rate
}

void loop() 
{
  if (Serial.available() > 0) 
  {
    int inByte = Serial.read();
    switch (inByte)
   {
     case 'A':
                MoveMotor(0);
                break;
     case 'B':    
                MoveMotor(512);
                break;     
     case 'C':    
                MoveMotor(1023);
                break;
   
     default:
   }
  }
}

void MoveMotor(Target)
{
  int PotVal =AnalogRead (Pot);
  if (PotVal > Target)
  {
   Speed = map (PotVal,Target,PotVal,0,255); 
   analogWrite (Enable, Speed);
   digitalWrite (A1, HIGH);
   digitalWrite (A2,LOW);
  }
  if (PotVal < Target)
  {
   Speed = map (PotVal,PotVal,Target,0,255); 
   analogWrite (Enable, Speed);
   digitalWrite (A1, LOW);
   digitalWrite (A2,HIGH);
  }
  else
 {
  digitalWrite (Enable,HIGH);
  digitalWrite (A1, LOW);
  digitalWrite (A2, LOW);
  return;
 }
}

ok. please try the program with your serial sending only A B or C no need to change to ASCII value. this way if you increase the number of stop position you dont have to change the program instead just add more stop along the way.