Society of Robots - Robot Forum

Software => Software => Topic started by: JadeKnight on September 28, 2009, 09:34:40 AM

Title: Axon PS2 Controller Interface Library
Post by: JadeKnight on September 28, 2009, 09:34:40 AM
I uploaded a library (.h and .c file) to interface with a PS2 controller using an Axon MCU. It should work with any AVR based MCU, though, with some minor modifications.

The low level PS2 communication code was adapted from 'Dunk's tutorial. (


    * Configurable pin assignments (uses 4 or 5 I/O pins, and 5v regulated power).
    * Supports connecting/disconnecting the controller at any time.
    * Detecting analog vs. digital mode.
    * Forcing analog mode on controller.
    * Easy access to all buttons and axes (axes can be raw, or with a simple deadzone).
    * Currently tested to work with a genuine Sony PS2 wired controller (any other brands/types *may* require some tweaking of the low-level communication code).

Download Link: (
Title: Re: Axon PS2 Controller Interface Library
Post by: dunk on February 23, 2010, 05:42:59 AM
hey JadeKnight,
good work!
apologies it's been so long since you posted, i've been away.

with this you've done 2 out of the 3 things i always meant to go back and do to my code.
ie, get the acknowledge pin working and tidy up the code and put everything in easy to include functions.

do you mind if i edit the original tutorial to link to your post @ Trossen?
pointless people hacking away with my code when you've already completed the job.

the 3rd thing i always intended to do with this was use the hardware SPI module instead of bit-banging.
i failed when i tried this before but i've a better understanding of the SPI module in AVRs now.
i'll get round to that one day.