Problem with my code,HELP!

Hi all, first of all, im trying to build a car with 1 servo and 1 motor, is a car that avoid things, said this, i have a problem with my code, and i can´t find the answer, if you could help me I would appreciate, thanks all for the help.

#include <AFMotor.h>
#include <Servo.h>

AF_DCMotor motor(1);

int steerPin = 10; // this is Servo 1 on the motor shield
Servo steerServo;

int pingPin = A0; // Analog pin 0 used for the Ping Pin (Trig)
int inPin = A1; // Analog pin 1 used for the Echo Pin (Echo)
unsigned long duration, inches;
int indec, cmdec;
int inchconv = 147; // ratio between puls width and inches
int cmconv = 59; // ratio between pulse width and cm
String s1, s2, s3;
int steerCentre = 95; // set this to be dead ahead setting (or adjust servo horn mounting)

void setup()
{
//Serial.begin(115200);
pinMode(pingPin, OUTPUT);
pinMode(inPin, INPUT);
steerServo.attach(steerPin, 1000, 2000);
steer(0);
}

void loop()
{
int cm, lcm, rcm;
forward(180);
delay(200);
cm = getDistance();
if(cm < 30)
{
halt();
steer(-60);
lcm = getDistance();
steer(60);
rcm = getDistance();
steer(0);
if (lcm < rcm)
steer(-60);
else
steer(60);
reverse(100);
delay(1500);
steer(0);
}
}

void steer(int angle)
{
steerServo.write(steerCentre + angle);
delay(800); // wait for servo to get there
}

int getDistance()
{
int rval;
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(10);
digitalWrite(pingPin, LOW);
duration = pulseIn(inPin, HIGH, 38000L); // Set timeout to 38mS
if (duration == 0)
duration = 1000;
rval = microsecondsToCentimeters(duration);
// Serial.println(rval);
return rval;
}

void forward (int spd)
{
motor.run(FORWARD);
motor.setSpeed(spd);
}

void reverse(int spd)
{
motor.run(BACKWARD);
motor.setSpeed(spd);
}

void spinLeft(int spd)
{
}

void spinRight(int spd)
{
}

void halt()
{
motor.run(RELEASE);
delay(10);
}

long microsecondsToCentimeters(long microseconds)
{
return microseconds / cmconv;
}

What is it doing and not doing?

Added: This here is no good. There is a library called NewPing, it is far better and more precise than the old style like your using. It should make things much easier for you.

Can you please put the code inside de "code" tag (in the tool bar) and read this.