Let's Make Robots!

PlayStation 2 Controller Arduino Library

Control your Robot with a PlayStation 2 Controller & Arduino

Figured I'd post my very easy to use Playstation 2 controller Arduino library. It's very easy to interface an Arduino with a Playstation 2 controller, and my library makes it very easy to program too. Simply read the gamepad every loop, and test to see if a button is pressed. All the availaible functions are included in the sample sketch file.

The first fully working version (v1.0) is now available.

The big change is you can now define what pins of the Arduino are used, no longer are you tied to pins 10-13.

Also, vibration (Rumble) and analog button pressure readings (how hard is a button being pressed) are now working.

The library has changed names. PSX -> PS2X to avoid confusion with other sets of code. Sorry for those that need to change a bunch of their programs.

I had to rewrite a lot of code that powers the library, there is not much left of the original code written by Shutter of Arduino forums. There were many bug fixes, now the controller should automatically be in analog mode, and the mode button should be locked. There’s also a catch to make sure not to much time has past since the last controller reading. If there was, it will configure the controller again, in case it timed out.

You can find my library HERE on my website.

Please submit any bug reports in the comments of my site, as it's easier to track there.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Cool! I might use that in nearest future. Thanks!!

Awesome indeed, you should try this: http://letsmakerobots.com/node/20619