Using gamepad plugged into USB Host to control servos?

I bought a Sparkfun USB Host. I tried to use Microsoft XBOX 360 wired gamepad to control servos but when I let go of the thumbsticks, the servos won't stop. Any suggestions?

#include <Servo.h> 
#include <XBOXUSB.h>
USB Usb;
XBOXUSB Xbox(&Usb);
Servo lservo,rservo;
int x_position;
int y_position;
void setup() 
{
  Serial.begin(115200);
  lservo.attach(5);
  rservo.attach(6);
  lservo.writeMicroseconds(1500);
  rservo.writeMicroseconds(1500);
  if (Usb.Init() == -1) 
  {
    Serial.print(F("\r\nOSC did not start"));
    while(1); //halt
  }  
  Serial.print(F("\r\nXBOX USB Library Started"));
}
void loop() 
{
  Usb.Task();
  if(Xbox.Xbox360Connected) 
  {
    //Xbox.setRumbleOn(Xbox.getButton(L2),Xbox.getButton(R2));
    if(Xbox.getAnalogHat(LeftHatX) > 7500 || Xbox.getAnalogHat(LeftHatX) < -7500 || Xbox.getAnalogHat(LeftHatY) > 7500 || Xbox.getAnalogHat(LeftHatY) < -7500 || Xbox.getAnalogHat(RightHatX) > 7500 || Xbox.getAnalogHat(RightHatX) < -7500 || Xbox.getAnalogHat(RightHatY) > 7500 || Xbox.getAnalogHat(RightHatY) < -7500) 
    {
      if(Xbox.getAnalogHat(LeftHatX) > 7500 || Xbox.getAnalogHat(LeftHatX) < -7500) 
      {
        x_position = Xbox.getAnalogHat(LeftHatX);
        map(x_position,-32767,32767,1000,2000);
        lservo.writeMicroseconds(x_position);
      }
      if(Xbox.getAnalogHat(LeftHatY) > 7500 || Xbox.getAnalogHat(LeftHatY) < -7500) 
      {
        //Serial.print(F("LeftHatY: ")); 
        //Serial.print(Xbox.getAnalogHat(LeftHatY));
        //Serial.print("\t");
      } 
      if(Xbox.getAnalogHat(RightHatX) > 7500 || Xbox.getAnalogHat(RightHatX) < -7500) 
      {
        //Serial.print(F("RightHatX: ")); 
        //Serial.print(Xbox.getAnalogHat(RightHatX));
        //Serial.print("\t");      
      } 
      if(Xbox.getAnalogHat(RightHatY) > 7500 || Xbox.getAnalogHat(RightHatY) < -7500) 
      {
        y_position = Xbox.getAnalogHat(RightHatY);
        map(y_position,-32767,32767,1000,2000);
        rservo.writeMicroseconds(y_position);
      }
      else
      {
        //Serial.println("");
        //lservo.writeMicroseconds(1500);
        //rservo.writeMicroseconds(1500);
      }
    }
    /*
    if(Xbox.buttonPressed) 
    {
      Serial.print(F("Xbox 360 Controller"));
      if(Xbox.getButton(UP)) 
      {
        Xbox.setLedOn(LED1);
        Serial.print(F(" - UP"));
      }      
      if(Xbox.getButton(DOWN)) 
      {
        Xbox.setLedOn(LED4);
        Serial.print(F(" - DOWN"));
      }
      if(Xbox.getButton(LEFT)) 
      {
        Xbox.setLedOn(LED3);
        Serial.print(F(" - LEFT"));
      }
      if(Xbox.getButton(RIGHT)) 
      {
        Xbox.setLedOn(LED2);
        Serial.print(F(" - RIGHT"));
      }
      if(Xbox.getButton(START)) 
      {
        Xbox.setLedMode(ALTERNATING);
        Serial.print(F(" - START"));
      }
      if(Xbox.getButton(BACK)) 
      {
        Xbox.setLedBlink(ALL);
        Serial.print(F(" - BACK"));
      }
      if(Xbox.getButton(L3))
        Serial.print(F(" - L3"));
      if(Xbox.getButton(R3))
        Serial.print(F(" - R3"));
      if(Xbox.getButton(L1))
        Serial.print(F(" - L1"));
      if(Xbox.getButton(R1))
        Serial.print(F(" - R1"));
      if(Xbox.getButton(XBOX)) 
      {
        Xbox.setLedMode(ROTATING);
        Serial.print(F(" - XBOX"));        
      }
      if(Xbox.getButton(A))
        Serial.print(F(" - A"));
      if(Xbox.getButton(B))
        Serial.print(F(" - B"));
      if(Xbox.getButton(X))
        Serial.print(F(" - X"));
      if(Xbox.getButton(Y))
        Serial.print(F(" - Y"));
      if(Xbox.getButton(L2)) 
      {
        Serial.print(F(" - L2:"));
        Serial.print(Xbox.getButton(L2));
      }
      if(Xbox.getButton(R2)) 
      {
        Serial.print(F(" - R2:"));
        Serial.print(Xbox.getButton(R2));
      }
      Serial.println();        
    }
   */ 
  }
  delay(1);
}

jeffmorris:
when I let go of the thumbsticks, the servos won't stop. Any suggestions?

Won't stop doing what?

Are you using "continuous-rotation servos" to drive wheels? At a minimum you will have to determine the value for writeMicroseconds() that gets your servos closest to stopping and write that when the control is in the dead band: -7500 to +7500. If that is not enough of a "stop" you will have to use servo.detach() to stop the servo. You will then have to re-attach the servo to the pin when you want to servo to go again.