Interfacing Servo motors using USB gamepad

Hello everyone. I want to make a robotic arm which i can control it by a USB gamepad. I will give you the link how to communicate arduino using USB gamepad

I have a problem in controlling the servo motors. I want to do something like this, if i press a button on my usb gamepad the servo will rotate clockwise and if I press another button that same servo will rotate anticlockwise. What happens is that if I press a button ti goes from 0 to 180 degrees and 180 to 0 degrees. but i cant control them independently. Could anyone plz post a code how to control servos independently.

Seems like at the moment you have a variant of the standard sweep tutorial but with a button in the mix somewhere.

Why don’t you post what you have so far… and what you’ve tried that incorporates the other button?

Here is my python code

Here is a part of the whole code to show actually which one I am using

def handleJoyEvent(e):
    # Assign actions for Button DOWN events
    if e.type == pygame.JOYBUTTONDOWN:
        # Button 1 (trigger)
        if (e.dict['button'] == 0):
            print "Trriger Down"
            # Set pin 13 LED to HIGH for digital on/off demo
            servo.move(99, 180)
        # Button 2
        if (e.dict['button'] == 1):
            print "Button 2 Down"
            servo.move(5, 180) #This is used to select servo no. 5 and rotate it to 180 degrees 
        # Button 4
        if (e.dict['button'] == 3):
            servo.move(5, 0) # #This is used to select servo no. 5 and rotate it back to 0 degrees 
            print "Button 4 Down"

Here button == 1 will rotate the servo clockwise and button == 3 will rotate that servo anticlockwise . Also there is another file where there is move(servo, angle) function. here servo means number which sends data to switch statement below.
Here is my arduino code

Below is a part of my ardiono code

        case 5:
          if(pos == 180)
            //What code should be written to rotate it clockwise as long as the button is pressed
          if(pos == 0)
            ////What code should be written to rotate it anti-clockwise as long as the button is pressed

I have used the switch statement because its easier to communicate with usb gamepad through