PlayStation 2 Analog Buttons
Duane Degn
Posts: 10,588
I read, a while back, on Wikipedia, the buttons on a PlayStation 2 controller are pressure sensitive.
None of the PlayStation 2 Objects I've seen use the pressure information. Since I hadn't seen any projects or objects that treated the buttons as analog inputs, I figured Wikipedia was wrong about the PS2 controller.
In attempts to modify one of the PS2 objects for a recent project, I learned that the PS2 controller does indeed have pressure sensitive buttons. With the help of the internet, I've got the Prop to read these (12) analog button values.
I personally think it is pretty cool to have this additional level of control from the PS2 controller. I have no idea how I'll use these analog buttons in any of my current projects, but I like knowing they're there.
I thought some of you might be interested in this information.
Are there any objects for the Propeller that read the analog button values? If not, I'll make sure and post the modified object.
Edit: Now in OBEX.
None of the PlayStation 2 Objects I've seen use the pressure information. Since I hadn't seen any projects or objects that treated the buttons as analog inputs, I figured Wikipedia was wrong about the PS2 controller.
In attempts to modify one of the PS2 objects for a recent project, I learned that the PS2 controller does indeed have pressure sensitive buttons. With the help of the internet, I've got the Prop to read these (12) analog button values.
I personally think it is pretty cool to have this additional level of control from the PS2 controller. I have no idea how I'll use these analog buttons in any of my current projects, but I like knowing they're there.
I thought some of you might be interested in this information.
Are there any objects for the Propeller that read the analog button values? If not, I'll make sure and post the modified object.
Edit: Now in OBEX.
Comments
https://docs.google.com/View?docid=ddbmmwds_5cw4pk3
Thanks for the links. The first link included a space character at the end that kept my browser from finding the correct page.
This link should take people to the correct page.
The second link took me to a Google Docs login page.
I'm just about finished with my demo showing off the analog nature of the PlayStation 2 buttons. I'll be uploading it soon.
Here's the output from the demo with the analog buttons turned on and with the square, circle and right arrow buttons pressed.
There aren't any methods to convert the raw data to joystick values. These conversions are done in PASM with the results written to hub RAM.
The parent object needs seven longs and 34 bytes to hold the controller information.
Once the PS2 object has been started, it doesn't need to be called again except to change modes. The controller is continuously polled with the new data continuously written to hub RAM.
The demo will start out in digital mode (boring); you'll need to press "b" on the keyboard to turn on the analog buttons.
I tried to add comments to explain how to use the object. One thing to keep in mind is that there are three different sets of button data being written to the hub.
Here's a quote from the comments.
I personally think it's pretty cool these buttons will output analog values and I look forward to using these buttons to control aspects of a robot.
Hopefully some of you will find it useful.
Let me know if any of you have questions or suggestions for improvement.
I do play to add control to the Dual Shock motors. I will also likely add a way of locking the controller in the various modes.
Edit(3/11/15): Warning, the code attached is an old version. There are likely better options available.
I plan to upload this program or an improved version to my GitHub account
If there isn't code similar to what is attached here on my on GitHub, send me a message and I'll make and check for any improved versions of the code.
The Curious Inventor has a lot of information about the PlayStation 2 controller.
I've read conflicting information about the controller. Is it a 5V device or a 3.3V device?
I'm currently powering it with 3.3V.
I know I've mentioned my dislike of generic controllers, but I thought I'd mention it again in this thread. The first controller I purchased was from SparkFun. I was disappointed to find the joysticks only had 5-bit resolution instead of the 8-bit resolution provided by the Sony controller.
I'd strongly recommend getting a Sony controller over a generic controller. The Sony controller only costs $5 more than the $10 generic. I just tried to find the $15 Sony controller I had seen on Amazon and I couldn't find it. This was the only normal black Sony PlayStation 2 controller I could find on Amazon and it costs $20.
I wish the reviews of the generic controller would mention how many bits of precision the used.
To be honest, I'm not sure how the 5-bits vs 8-bits would effect my use of the controller. It just bugs me on principle that the generic controller has less resolution the original Sony controller.
http://obex.parallax.com/object/460
If any of you use PlayStation 2 controllers, I hope you give it a try.
The OBEX links in this thread no longer work. I get a 404 error trying to access them. You may want to update the links here to the new OBEX URLs...
dgately
I try to keep the links in my index up to date but I didn't think about my one and only OBEX entry.