Playstation Controller Hex Values.
I use PS2 controllers in some of my projects and have mapped the hex values for all the button combinations.
Thought others may find this useful.
I made a small spreadsheet with the all the possible values for a PS2 controller.
Thought others may find this useful.
I made a small spreadsheet with the all the possible values for a PS2 controller.
Comments
I've been working on a robot remote using a PS2 controller. (I've delayed most of my robot projects until I get it done.)
I've also been recently studying the PlayStation 2 data.
I think you're referring to the wrong set of data here.
The value $5A is actual information about the controller. I think all normal PlayStation 2 controllers use this same code.
the value $73 is information about the mode the controller is in and how many words of data after the header the controller is sending.
The nibble $7 indicates its in analog mode. A $4 here indicates digital mode and $F indicates config mode.
The nibble $3 indicates there are three 16-bit words of data being transmitted. Both the PS2 objects I've tried actually return the bytes within in a group of four in reverse order so the first word returned is the $FFFF that proceeds the $5A73. As you indicated, this word of data contains button state information. Each bit contains the state of one button. A zero indicates a button press and a one indicates it's not pressed.
The long of data following this initial long contains the joystick data.
12 of the buttons can also be read in analog button mode where a value of 0 to $FF is returned to indicate the about of pressure on each button. When the analog buttons are turned on, the header is no longer $5A73 but $5A79, to show that nine words of data are being transmitted. The additional six words contain the button pressure information.
I recently posted an object that reads this analog button information. Here's a link to the thread where I posted it.
I've been trying to figure out how to use the analog button information to enhance control of a hexapod. I haven't come up with anything yet.
The above xls sheet will work for the button values.
There is a typo for the select button. It should be $FFFE5A73 as well.
I'll post a new xls file with the changes.
Judging from the many PS2, iPhone and Xbee control posts, I must be the last guy who thinks basic IR control is still pretty cool for a small robot.
If nothing else, IR is cheap, fully worked out & well-documented. A buck for an IR sensor, a buck for a universal remote at the dollar store, and a quick copy & paste of the read_IR code!