best place to look is the examples for Bill porters library
https://github.com/madsci1016/Arduino-PS2X/blob/master/PS2X_lib/Examples/PS2X_Example/PS2X_Example.pde.
ps2x.read_gamepad(false, vibrate); //read controller and set large motor to spin at 'vibrate' speed
vibrate = ps2x.Analog(PSAB_BLUE); //this will set the large motor vibrate speed based on
//how hard you press the blue (X) button