Mindsensors Sony PlayStation 2 Controller with LeJos

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: imaqine, 99jonathan, roger

New User
Posts: 4
Joined: Mon Feb 18, 2008 5:17 pm

Mindsensors Sony PlayStation 2 Controller with LeJos

Postby CraigMcCahill » Mon Feb 18, 2008 5:59 pm


Has anybody got the Mindsensors Sony PlayStation 2 Controller working with LeJos?

On the Mindsensors website there is a NXT-G block for download but no LeJos library but no LeJos API :(

I understand some developers have written apps for this in C.

Thanks for any help


User avatar
leJOS Team Member
Posts: 305
Joined: Wed Dec 05, 2007 1:27 am
Location: New Mexico, USA

Postby kirkpthompson » Mon Feb 18, 2008 6:14 pm

Send me a controller and a Mindsensors controller interface and I will write a class for you...


User avatar
Site Admin
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby bbagnall » Wed Feb 27, 2008 7:03 am

Hi Craig,

That would be very easy to write. I just downloaded the docs and it's pretty basic. I'll upload a new class tomorrow to subversion. You can download and compile it from there, and it will be part of the next general release.

User avatar
Site Admin
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby bbagnall » Wed Feb 27, 2008 4:55 pm

Hi Craig,

The alpha PS2 controller class is now checked in here:
http://lejos.svn.sourceforge.net/viewvc ... a?view=log
You can click on download or view to get the class. You probably want to compile it in a default directory so comment out the package info at the top.

I would appreciate it if you could test it out and let me know how it goes. A few things I would appreciate are:
- the method names might not be very user friendly so please suggest some if need be.
- I assume analog mode gives a range of joystick values and digital mode makes the joystick on-off. Please let me know what value ranges you get for each of these modes
- The button method returns one short byte which encodes all the button states in the 16 bits of the short value, so you will have to do some bit-math to get the values. Would you prefer a method to return an array of 16 boolean values instead? This might be easier for users.
- Probably this class would benefit from an event-listener since it is a HID device. I'll add this once we confirm the basics are working.

BTW Email me at the link below as it will be quicker than going through the forums.

Return to “NXJ Hardware”

Who is online

Users browsing this forum: No registered users and 2 guests