Help with Servo and Ultrasonic RangeFinder

Hi Guys, I am having some trouble creating a circuit that would allow a Servo to spin faster as an object comes closer to a Ping))) Ultrasonic Sensor.
Only the first two speeds are working the rest is not.
Here is my code so far:
!!I did not write up this code in its entirety!!

const int pingPin = 11; //sensor pin
#include<Servo.h>
Servo myservo1;
int minPulse1 = 1170;
int maxPulse1 = 1170;
int turnRate1= 75;
String readString;


void setup() {
  Serial.begin(9600);  
  myservo1.writeMicroseconds(1500);
  myservo1.attach(10);
pinMode(2, OUTPUT); // Green 1
pinMode(3, OUTPUT); // Green 2
pinMode(4, OUTPUT); // Yellow 1
pinMode(5, OUTPUT); // Yellow 2
pinMode(6, OUTPUT); // Red 1






digitalWrite(2, HIGH);  
digitalWrite(3, HIGH);  
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
delay (500);
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
}
void loop()
{

  long duration, inches, cm;


  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);


  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);


  // convert the time into a distance
  inches = microsecondsToInches(duration);


 
if (inches < 15) {
  digitalWrite(6, HIGH);}
if (inches > 15) {
  digitalWrite(6, LOW);}
  
if (inches < 15) {
  myservo1.writeMicroseconds(1700);}

if (inches > 15) {
  myservo1.writeMicroseconds(1500);} 
 
if (inches < 10) {
  digitalWrite(5, HIGH);}
if (inches > 10) {
  digitalWrite(5, LOW);}
  
if (inches < 10) {
  myservo1.writeMicroseconds(1850);}
 
 
if (inches < 5) {
    digitalWrite(4, HIGH);}
if (inches >5)  {
    digitalWrite(4, LOW);}
    
if (inches < 5) {
  myservo1.writeMicroseconds(2100);}

   
if (inches < 3) {
    digitalWrite(3, HIGH);}
if (inches > 3) {
    digitalWrite(3, LOW);}
    
if (inches < 3) {
  myservo1.writeMicroseconds(2200);}
   
if (inches < 2) {
    digitalWrite(2, HIGH);}
if (inches > 2) {
    digitalWrite(2, LOW);}
 
if (inches < 2) {
  myservo1.writeMicroseconds(2200);}
    
 
  delay(100);
}


long microsecondsToInches(long microseconds)
{
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

h

!!I did not write up this code in its entirety!!

But you expect a complete answer?

if (inches < 15) {
  digitalWrite(6, HIGH);}
if (inches > 15) {
  digitalWrite(6, LOW);}
  
if (inches < 15) {
  myservo1.writeMicroseconds(1700);}

You do realise you’re allowed to combine conditionals?

You do realise you're allowed to combine conditionals?

And, not only are you allowed to use else statements, you are strongly encouraged to.

Only the first two speeds are working the rest is not.

You have not got much speed difference between the steps as the distance reduces below 5 inches and none at all between 3 and 2. What do the LEDs do as you move closer ?

Are you sure that the program is getting to all of the statements that change the servo speed ? Try printing the value of inches after you have read the sensor and converted the value to make sure that you are getting what you expect.