Ardumoto RC Car

Hey, ive hijacked the motor of an old rc car and mounted a servo in the front to control the steering. I can control the motor using the code presented here, (projectallusion.com) coupled with processing and my iphone. I am trying to instead of having the second slider control motor #2, to control the steering servo. I have modified the code, but it doesnt work. Here is my arduino code:
(all the origional code is on the website above.)
Someone plz help me!


#include <Servo.h>

#define PwmPinMotorA 10
#define PwmPinMotorB 11
#define DirectionPinMotorA 12
#define DirectionPinMotorB 13
#define SerialSpeed 9600
#define BufferLength 16
#define LineEnd '#'

char inputBuffer[BufferLength];

Servo servo1;
void setup()
{
// motor pins must be outputs
pinMode(PwmPinMotorA, OUTPUT);
pinMode(PwmPinMotorB, OUTPUT);
pinMode(DirectionPinMotorA, OUTPUT);
pinMode(DirectionPinMotorB, OUTPUT);

Serial.begin(SerialSpeed);

servo1.attach(9);
}

// process a command string
void HandleCommand(char* input, int length)
{
Serial.println(input);
if (length < 2) { // not a valid command
return;
}
int value = 0;
// calculate number following command
if (length > 2) {
value = atoi(&input[2]);
}
int* command = (int*)input;
// check commands
// note that the two bytes are swapped, ie 'RA' means command AR
switch(*command) {
case 'FA':
// motor A forwards
analogWrite(PwmPinMotorA, value);
digitalWrite(DirectionPinMotorA, HIGH);
break;
case 'RA':
// motor A reverse
analogWrite(PwmPinMotorA, value);
digitalWrite(DirectionPinMotorA, LOW);
break;
case 'FB':
// motor B forwards
analogWrite(PwmPinMotorB, value);
digitalWrite(DirectionPinMotorB, LOW);
break;
case 'RB':
// motor B reverse
analogWrite(PwmPinMotorB, value);
digitalWrite(DirectionPinMotorB, HIGH);
break;
case 'b':
servo1.write(value);
break;

default:
break;
}
}

void loop()
{
// get a command string form the serial port
int inputLength = 0;
do {
while (!Serial.available()); // wait for input
inputBuffer[inputLength] = Serial.read(); // read it in
} while (inputBuffer[inputLength] != LineEnd && ++inputLength < BufferLength);
inputBuffer[inputLength] = 0; // add null terminator
HandleCommand(inputBuffer, inputLength);
}


And here is my modified processing code:


import oscP5.;
import netP5.
;
import processing.serial.*;
Serial arduinoPort;
OscP5 oscP5;

float [] fader = new float [3];
int steeringVal;

void setup() {
oscP5 = new OscP5(this,8000);
arduinoPort = new Serial(this, Serial.list()[0], 9600);
}

void oscEvent(OscMessage theOscMessage) {

String addr = theOscMessage.addrPattern();

if(addr.indexOf("/1/fader") !=-1){
String list[] = split(addr,'/');
int xfader = int(list[2].charAt(5) - 0x30);
if(theOscMessage.get(0).floatValue() !=0){
fader[xfader] = theOscMessage.get(0).floatValue();
}
}
}

void draw() {

//---------------------------------Motor A
if(fader[1] > 0.65){
arduinoPort.write("AF255#");
}
if(fader[1] < 0.35){
arduinoPort.write("AR255#");
}
//--------------------------------Motor B
steeringVal= round(fader[2])*180;
{
arduinoPort.write("b"+steeringVal);
}
//----------------------------stop commands
if(fader[1] < 0.65 && fader[1] > 0.35 ){
arduinoPort.write("AF0#");
}
}