Here is the manual entry for gamepad -
I think what you are looking for is the following expression:
Retrieve the current position of an analog joystick on a specific gamepad. Index specifies left analog X and Y or right analog X and Y axes, subject to Key mapping. Axes range from -100 to 100. Axis values within the Analog deadzone are returned as 0.
So use this to get X and Y values that you can use in the arctangent formula.