help with Bi directional PID motor control

HI,
I'm trying to make a motor that i can control and regulate position based on feedback from a potentiometer. The program gets it's PID target value from another potentiometer. essentially it's a servo but with a 12V motor.
any help would be greatly appreciated, I posted the code below:

Thanks,
Rhetkun

ps. for PID control i used the new PID library 1.0.1 =)

#include <PID_v1.h>


#define forward 3
#define reverse 5
#define potpin 0
#define servopot 1

double Setpoint, Input, Output;

PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);


void setup()
{
Serial.begin(9600);
pinMode(forward,OUTPUT);
pinMode(reverse,OUTPUT);
pinMode(potpin,INPUT);
pinMode(servopot,INPUT);

Setpoint = map(analogRead(potpin),0,1023,0,220);
Input = map(analogRead(servopot),0,1023,0,180);

myPID.SetMode(AUTOMATIC);
myPID.SetSampleTime(10);

}



void loop()
{

Setpoint = map(analogRead(potpin),0,1023,0,220);
Input = map(analogRead(servopot),0,1023,0,180);

myPID.Compute();
if(Input<Setpoint)    
{

digitalWrite(reverse,LOW);
analogWrite(forward,Output);
}

if(Input>Setpoint)
{

digitalWrite(forward,LOW);
analogWrite(reverse,Output);

}

}

Any particular reason you're using PID, instead of a window comparator logic design (do you need the absolute accuracy - note that this really only applies if you are using accurate/tight mechanical linkage between the motor and potentiometer, and your potentiometer is a high-tolerance/accuracy device)? Have you seen this thread?

http://arduino.cc/forum/index.php/topic,60163.0.html

Depending on your application, PID might just be overkill (certainly standard r/c servos don't use PID)...

hey thanks man, I tweaked my code to accomodate window comparator logic and it works great!
I owe you......

Cheers