Message

Home

joymex2

Update August 1st 2011: added support for POV Hats.

joymex2 is a MATLAB MEX-file which provides access to gamepad devices in MATLAB through SDL. The MEX-file can be used as is, for simply querying axes and buttons status of all connected gamepad devices but it can also be used as a starting point to implement more advanced features like force feedback. (I might even add some simple force feedback support in the coming weeks myself.)

Prerequisites

General

  • MATLAB R2006a or higher

Windows

Linux

Usage

Open Joystick with ID 0:

>> joymex2('open',0)
Opened Joystick 0
Name: Microsoft X-Box 360 pad
Number of Axes: 6
Number of Buttons: 11
Number of Hats: 1 

Query data from Joystick with ID 0:

>> data = joymex2('query',0)
data = 

       axes: [0 0 0 0 0 0]
    buttons: [0 0 0 0 0 0 0 0 0 0 0
       hats: [1x1 struct]
>> data.hats
ans = 

       up: 0
    right: 0
     down: 0
     left: 0 

Close Joystick with ID 0:

>> joymex2('close',0)

Also see the example joytest.m which is included in the downloads.

Building

If all prerequisites above are met (and mex has been configured through mex -setup), the MEX-file can be build by running build.m which is inlcuded in the downloads.

Download

Windows

joymex2.zip

Linux

joymex2.tar.gz

Help

If you run into any difficulties or need any help in using the MEX-file please e-mail to: devel[at]escabe.org

Joomla templates by a4joomla