We have been using an XBox controller. Any Game Controller that can be recognized by Windows can be used for input. You can use a PS3 controller but you have to download drivers that may or may not work in competition.
First, construct a new Joystick object:
The 1 indicates the first Joystick on your Driverstation, you can check how many joysticks the DS has recognized under the "Diagnostics" tab of the application.
You can then use the
Joystick API to retrieve button and axis states.
Some people like using the built in getter methods like j1.getX() but I just like calling j1.GetRawAxis(1).
Here's a basic guide to the axises:
1: Left Stick X
2: Left Stick Y
3: Triggers (Pulling the Right Stick returns .5-1, Pulling the left stick is 0-.5, neutral is .5)
4: Right Stick X
5: Right Stick Y
You can also run j1.GetRawButton(int button) which returns bool (true means the button is pressed down).
I don't remember off the top of my head what the buttons map to, but in your driver station you can: Click Windows + R > type in joy.cpl > Click on the properties of the Xbox Controller > Watch the numbers light up as you press the buttons.
I know pressing A will make "Button 1" light up. This means running j1.GetRawButton(1) will return true when pressed down.