Motor Controller & Sensor won't work at same time

I am trying to drive a motor with a Banebots motor controller and a sonar sensor.
It wouldn’t work no matter what we did so we broke it down to find the root of the problem. Basically, we can control the motor by giving it a speed, but if the loop also reads the sensor the motor doesn’t move. even if the reading isn’t doing anything to control the speed.
For Example:
This works
void loop()
{
int a=1500;
while ( a < 1600){
esc.writeMicroseconds(a); d
a=a+1;
delay(300);
}

}

but this doesn’t:

void loop()
{
int b=analogRead(0);
int a=1500;
while ( a < 1600){
esc.writeMicroseconds(a); //output should be a value between 1300-1700, with 1500 off, 1300 full reverse, 1700 full forward
a=a+1;
delay(300);
}

}

any ideas as to what the problem is?

The Servo library, which you appear to be using, uses a timer. Other classes and functions use timers, too.

It will be very difficult for us to determine whether the timers being used conflict, unless you post all of your code.

#include <Servo.h>

Servo esc;

void arm()
{
esc.writeMicroseconds(1500);
delay(1000);
}
void setup()
{
esc.attach(9); //white pin of speed controller should be attached to pin 9
arm();
Serial.begin(9600);
}

void loop()
{
int b=analogRead(0);
int a=1500;
while ( a < 1600){
esc.writeMicroseconds(a); //output should be a value between 1300-1700, with 1500 off, 1300 full reverse, 1700 full forward
a=a+1;
delay(300);
}

}

int proportional1()
{
int sensorvalue = 0;
int proportional = 0;

sensorvalue=analogRead(A0);
proportional=(sensorvalue-200)*200/280+1500;
Serial.println(proportional);
return proportional;
}

This code should work, I have done similar things with a potentiometer and a regular servo. What version of the Arduino IDE are you using? The lastest?

Korman