PS2 Controller as Counter function

Hello guys, I plan to make PS2 Controller Direction Pad (D-Pad) Buttons as counter function (could be cross, square, or triangle button though). Assume the inital value of x=0 and final value of xp = 0. Whenever I press "right button", the x will increase by 1, which means the Xp will become 1. If I press the "right button" 2 times, the Xp will become 2 and so on. Meanwhile, I press "left button" to decrease the xp value by 1. Lets just say the xp is 10. If I press "left button" 2 times, xp now becomes 8 and so on. Anybody knows how to write the program? All I can find is counter function using push button. Any advice will be appreciated.

Does the program you found work with your PS2? You can use it as the base for the program you want.

Paul