Gamepad connected to computer controls servos connected to Arduino board?

Is it possible to have a gamepad connected to computer control servos connected to Arduino board?

gamepad > computer > Arduino board > servos

gamepad > computer > Xbee > Xbee > Arduino board > servos

If it is a PS2 gamepad then you can just connect it directly to the arduino. I've done this before and it worked perfectly.

I don't have PS2 gamepad. I have XBOX 360 gamepad.

Ok, there is a library that allows you to use a Xbox controller with an arduino, check this out.

and maybe this.

I am hearing-impaired and the video doesn't have captioning.

I am hearing-impaired and the video doesn't have captioning.

There are links below the video when the below is viewed at the youtube site. click the youtube icon on the bottom right of the video frame.

I tried the links below the video but the person who created the video made his own motor controller. I don't know if he uses XBee modems or not.

That xbox controller is either USB or Bluetooth, so you will need either a BT module or USB module, to communicate between it and the arduino.

There are wired and wireless XBOX 360 gamepads. The person in the video was using a wired XBOX 360 gamepad. Do I need an USB Host Shield like this: https://www.sparkfun.com/products/9947 ?

Yea that would work.

Am I supposed to run the Gamepad Processing code on my computer and the Motor Arduino code on the Arduino board? Running the Gamepad Processing code opens the Gamepad window where I see the sliders move when I move the thumbsticks on the gamepad. After uploading the Motor code to the Arduino, I open the Serial Monitor and the X-CTU window but nothing is happening on either terminal window. The person in the video uses motors controlled by H-Bridge circuit. My robot uses continuous servos. Any suggestions?

post both codes

Controller Code!

I didn't write the code. Someone else wrote the code. Gamepad V2.0 seems to work but Motor V2.0 doesn't work because he uses motors connected to H-Bridge circuit and I have servos. He made his own H-Bridge circuit. I have Pololu Simple Motor Controller, Sparkfun Serial Controlled Dual Motor Driver, Seeed Studio Motor Shield, and Tamiya Twin Motor Gearbox. I'm not sure which motor controller work.

Ok, are you using the servo library to control your servos? His code will obviously need to be altered to work with your servos.

I tried to modify the code to control two DC motors connected to Seeed Studio Motor Shield. 0 to 127 runs the motor forward. 0 to -127 runs the motor backward.

Link to Seeed Studio Motor Shield Wiki: Motor Shield | Seeed Studio Wiki

int pinI1=8;//define I1 interface
int pinI2=11;//define I2 interface 
int speedpinA=9;//enable motor A
int pinI3=12;//define I3 interface 
int pinI4=13;//define I4 interface 
int speedpinB=10;//enable motor B
int spead =127;//define the spead of motor
byte checkByte = 0;         // incoming serial byte
byte lMotorSpeed = 0;
byte rMotorSpeed = 0;
byte lMotorDir = 0;
byte rMotorDir = 0;
int ledPin = 4;
int counter = 0;
int timeout = 15; // about half a second
int second = 0;
void setup()
{
  Serial.begin(9600);
  pinMode(pinI1,OUTPUT);
  pinMode(pinI2,OUTPUT);
  pinMode(speedpinA,OUTPUT);
  pinMode(pinI3,OUTPUT);
  pinMode(pinI4,OUTPUT);
  pinMode(speedpinB,OUTPUT);
}
void loop()
{  
  if(Serial.available()) 
  {
    if (Serial.available() > 2) 
    {
      checkByte = Serial.read();
      if(checkByte == '#') 
      {
        counter = 0;
        digitalWrite(ledPin, HIGH);
        lMotorSpeed = Serial.read();
        rMotorSpeed = Serial.read();
        //Serial.println("checkByte OK!");
        lMotorSpeed = (Serial.read()-'0')*100;
        lMotorSpeed += (Serial.read()-'0')*10;
        lMotorSpeed += (Serial.read()-'0');
        //Serial.print("L Value Read: ");
        //Serial.println(lMotorSpeed, BIN);
        rMotorSpeed = (Serial.read()-'0')*100;
        rMotorSpeed += (Serial.read()-'0')*10;
        rMotorSpeed += (Serial.read()-'0');
        //Serial.print("R Value Read: ");
        //Serial.println(rMotorSpeed, BIN);
        lMotorDir = bitRead(lMotorSpeed, 7);
        rMotorDir = bitRead(rMotorSpeed, 7);
        //Serial.print("L Motor Dir: ");
        //Serial.println(lMotorDir, BIN);
        //Serial.print("R Motor Dir: ");
        //Serial.println(rMotorDir, BIN);
        if(lMotorDir) 
        {
          //Serial.println("L Motor Dir: Backwards");
          digitalWrite(pinI4,LOW);//turn DC Motor B move anticlockwise
          digitalWrite(pinI3,HIGH);
        }  
        else 
        {
          //Serial.println("L Motor Dir: Forwards");
          digitalWrite(pinI4,HIGH);//turn DC Motor B move clockwise
          digitalWrite(pinI3,LOW);
        }
        if(rMotorDir) 
        {
          //Serial.println("R Motor Dir: Backwards");
          digitalWrite(pinI2,HIGH);//turn DC Motor A move clockwise
          digitalWrite(pinI1,LOW);
        }  
        else 
        {
          //Serial.println("R Motor Dir: Forwards");
          digitalWrite(pinI2,LOW);//turn DC Motor A move anticlockwise
          digitalWrite(pinI1,HIGH);
        }
        lMotorSpeed = map(lMotorSpeed, 0, 127, 0, 127);
        rMotorSpeed = map(rMotorSpeed, 0, 127, 0, 127);
        analogWrite(speedpinA,lMotorSpeed);//input a simulation value to set the speed
        analogWrite(speedpinB,rMotorSpeed);
      }
    }
  }
}

And does it work?
You want to use servos, so whatever in this code is being used to control the DC motors, you need to replace with the servo library.

Have you tried the servo library?

I put the robot with servos on the side (I'm not using it for now) and use the motor shield to control two DC motors. The motors didn't work properly. I think the map(a,b,c,d) command needs to be changed.

post your code

int pinI1=8;//define I1 interface
int pinI2=11;//define I2 interface 
int speedpinA=9;//enable motor A
int pinI3=12;//define I3 interface 
int pinI4=13;//define I4 interface 
int speedpinB=10;//enable motor B
int spead =127;//define the spead of motor
byte checkByte = 0;         // incoming serial byte
byte lMotorSpeed = 0;
byte rMotorSpeed = 0;
byte lMotorDir = 0;
byte rMotorDir = 0;
int ledPin = 4;
int counter = 0;
int timeout = 15; // about half a second
int second = 0;
void setup()
{
  Serial.begin(9600);
  pinMode(pinI1,OUTPUT);
  pinMode(pinI2,OUTPUT);
  pinMode(speedpinA,OUTPUT);
  pinMode(pinI3,OUTPUT);
  pinMode(pinI4,OUTPUT);
  pinMode(speedpinB,OUTPUT);
}
void loop()
{  
  if(Serial.available()) 
  {
    if (Serial.available() > 2) 
    {
      checkByte = Serial.read();
      if(checkByte == '#') 
      {
        counter = 0;
        digitalWrite(ledPin, HIGH);
        lMotorSpeed = Serial.read();
        rMotorSpeed = Serial.read();
        //Serial.println("checkByte OK!");
        lMotorSpeed = (Serial.read()-'0')*100;
        lMotorSpeed += (Serial.read()-'0')*10;
        lMotorSpeed += (Serial.read()-'0');
        //Serial.print("L Value Read: ");
        //Serial.println(lMotorSpeed, BIN);
        rMotorSpeed = (Serial.read()-'0')*100;
        rMotorSpeed += (Serial.read()-'0')*10;
        rMotorSpeed += (Serial.read()-'0');
        //Serial.print("R Value Read: ");
        //Serial.println(rMotorSpeed, BIN);
        lMotorDir = bitRead(lMotorSpeed, 7);
        rMotorDir = bitRead(rMotorSpeed, 7);
        //Serial.print("L Motor Dir: ");
        //Serial.println(lMotorDir, BIN);
        //Serial.print("R Motor Dir: ");
        //Serial.println(rMotorDir, BIN);
        if(lMotorDir) 
        {
          //Serial.println("L Motor Dir: Backwards");
          digitalWrite(pinI4,LOW);//turn DC Motor B move anticlockwise
          digitalWrite(pinI3,HIGH);
        }  
        else 
        {
          //Serial.println("L Motor Dir: Forwards");
          digitalWrite(pinI4,HIGH);//turn DC Motor B move clockwise
          digitalWrite(pinI3,LOW);
        }
        if(rMotorDir) 
        {
          //Serial.println("R Motor Dir: Backwards");
          digitalWrite(pinI2,HIGH);//turn DC Motor A move clockwise
          digitalWrite(pinI1,LOW);
        }  
        else 
        {
          //Serial.println("R Motor Dir: Forwards");
          digitalWrite(pinI2,LOW);//turn DC Motor A move anticlockwise
          digitalWrite(pinI1,HIGH);
        }
        lMotorSpeed = map(lMotorSpeed, 0, 127, 0, 127); 
        rMotorSpeed = map(rMotorSpeed, 0, 127, 0, 127);
        analogWrite(speedpinA,lMotorSpeed);//input a simulation value to set the speed
        analogWrite(speedpinB,rMotorSpeed);
      }
    }
  }
}

I think that these commands need to be changed:
map(lMotorSpeed, 0, 127, 0, 127);
map(rMotorSpeed, 0, 127, 0, 127);

I tried to follow the instructions at Principialabs.com but the person who created the article with video used Linux instead of Windows. Any suggestions?