How can I control speed and position of a motorized slide pot w/ an H-bridge?

So I'm trying to control this 10k slide pot (Slide Pot - Motorized (10k Linear Taper) - COM-10976 - SparkFun Electronics) with a Texas Instruments SN754410 H-Bridge.

I've been using the DC Motor Control Using an H-Bridge tutorial from ITP as a starting point. As you can see below, I've tidied it up a bit to my liking.

http://itp.nyu.edu/physcomp/Labs/DCMotorControl

Basically, I'm looking to control the movements (motorForward and motorReverse) using OSC commands via TouchOSC on an iPad. But what I'm here for is asking:

(1) how can I control the speed of slide pot?

(2) how can I use the motorStop function I've created? It shoots back and forth way too fast and I'd like to have an option that has it stop in the middle.

I figure I may need to switch from digitalWrite to analogWrite and use PWM in order to achieve this but I'm not quite sure the right combination of frequencies between the two logic pins on the H-Bridge, which the tutorial only describes as a combo of highs and lows.

Any help appreciated.

const int switchPin = 7; // switch input
const int motorPinA = 6; // H-bridge leg 1 (pin 2, 1A) PWM
const int motorPinB = 5; // H-bridge leg 2 (pin 7, 2A) PWM
const int enablePin = 9; // H-bridge enable pin
const int lineTrack = 5; //line track for position reading

void setup(){

  Serial.begin(9600);

  // set the switch pin and line track as inputs:
  pinMode(switchPin, INPUT);
  pinMode(lineTrack, INPUT);

  //set the motor logic pins and enable pin as outputs
  pinMode(motorPinA, OUTPUT);
  pinMode(motorPinB, OUTPUT);
  pinMode(enablePin, OUTPUT);
}

void loop() {
  // set enablePin high so that motor can turn on:
  digitalWrite(enablePin, HIGH);

  //Obtain position reading
  int pos = analogRead(lineTrack); //read the line positioning
  pos = map(pos, 0, 1023, 0, 110); //remap positioning to scale of 0-100
  //For proper readings, insert 2 to A5, 3 to 5V, 1 to GND

  String stringA = "Sensor value: "; //add string for easier debugging
  String stringA1 = stringA + pos;
  Serial.println(stringA1); //print positioning information

  //Move motor forward if switch is on
  if(digitalRead(switchPin) == HIGH) {
    motorForward();
  }

  //Move motor backward if switch is off
  if(digitalRead(switchPin) == LOW) {
    motorBackward();
  }

void motorForward(){ //potentially add int PWM_val as parameter
  digitalWrite(motorPinA, LOW);
  digitalWrite(motorPinB, HIGH);
}

void motorBackward(){
  digitalWrite(motorPinA, HIGH);
  digitalWrite(motorPinB, LOW);
}

void motorStop(){
  digitalWrite(motorPinA, HIGH);
  digitalWrite(motorPinB, LOW);
}

(1) how can I control the speed of slide pot?

Apply an analogue write to the enable pin. However that only works well for a motor under a heavy load. It looks like you have the wrong type of motor here. If you want good control over the speed then a stepping motor is best.

I've noticed it goes slower if I apply it 9V instead of 12V, so I may just go with that.

Do you have any recommendations about the motorStop? Or am I out of luck with this motor?

I don't know what you mean by motor stop, however if it is this code :-

void motorBackward(){
  digitalWrite(motorPinA, HIGH);
  digitalWrite(motorPinB, LOW);
}

void motorStop(){
  digitalWrite(motorPinA, HIGH);
  digitalWrite(motorPinB, LOW);
}

Then what is the difference between the backwards and the stop?

To use flywheel breaking on a motor both ends of the motor must be at the same potential. So you would need:-

void motorStop(){
  digitalWrite(motorPinA, HIGH);
  digitalWrite(motorPinB, HIGH);
}

Have you seen this:-
http://www.thebox.myzen.co.uk/Workshop/Motors_1.html
and
http://www.thebox.myzen.co.uk/Workshop/Motors_2.html

Ooh, silly error there. Thanks for noticing that. I'll have to try it back out when I'm at the lab (don't have my Arduino on me). Ideally, I'm trying to have the slider stop midway so I'd have three inputs and three outputs (forward all the way, backward all the way, middle position). I'll read the links you sent over in a bit.

Project progress & concerns moved to this thread: http://arduino.cc/forum/index.php/topic,135074.0.html