# Joystick functions for Windows

**URL:** <https://psychtoolbox.discourse.group/t/joystick-functions-for-windows/1691>\
**Category:** Uncategorized\
**Created:** [August 24, 2001, 12:52am UTC](https://psychtoolbox.discourse.group/t/joystick-functions-for-windows/1691 "2001-08-24T00:52:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [August 24, 2001, 12:52am UTC](https://psychtoolbox.discourse.group/t/joystick-functions-for-windows/1691/1 "2001-08-24T00:52:52Z")

</div>

I have attached new functions for reading joysticks from within Matlab  
on Windows. They should work with any USB joystick with drivers for  
Windows.  
  
The README.TXT file from the package is attached to this message, it  
gives details.  
  
Allen

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [May 28, 2002, 9:55am UTC](https://psychtoolbox.discourse.group/t/joystick-functions-for-windows/1691/2 "2002-05-28T09:55:39Z")

</div>

Hi Allen, my name is Roberto and I'm a PHD student of the CNR in Pisa.  
Could you tell me why I receive this kind of error everytime I use   
the joystick function?  
"Unable to load mex file: c:\matlab6p1  
\psychtoolbox\psychjoystick\Joystick.dll.  
The specified module could not be found.  
  
  
??? Invalid MEX-file  
  
Error in ==\> c:\matlab6p1  
\psychtoolbox\psychdemos\joystickdemo\JoystickDemo.m  
On line 61 ==\> NumberJoysticks = JOYSTICK('GetNumJoysticks');"  
  
Thanks in advance for your help.  
Roberto  
  
  
  
  

> --- In psychtoolbox@y..., "Allen W. Ingling" \<ingling@c...\> wrote:  
> \>   
> \> I have attached new functions for reading joysticks from within   
> Matlab  
> \> on Windows. They should work with any USB joystick with drivers for  
> \> Windows.  
> \>   
> \> The README.TXT file from the package is attached to this message, it  
> \> gives details.  
> \>   
> \> Allen  
> \>   
> \>   
> \>   
> \>   
> \>   
> \>   
> \> Distribution Notes for Psychtoolbox Joystick Functions for Windows.  
> \>   
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \_\_\_\_\_\_\_  
> \>   
> \>   
> \> The Joystick function will be included in the next release of the   
> Psychtoolbox, version 2.46. It is released separately, here in this   
> package, ahead of the full Psychtoolbox version 2.46.   
> \>   
> \> The Joystick function should work with any USB joystick available   
> for Windows. It and JoystickDemo.m have been tested with the Gravis   
> GamePad Pro USB and the Gravis Destroyer AfterShock joysticks in   
> Matlab version 6.1, with Psychtoolbox version 2.45 under Windows   
> 2000.   
> \>   
> \> For bug reports and comments you may either contact the author,   
> Allen Ingling, or post a message to the Psychtoolbox Forum.  
> \> Allen Ingling: ingling@c...  
> \> Psychtoolbox Forum: psychtoolbox@y...   
> \> Psychtoolbox Forum online:   
> [http://groups.yahoo.com/group/psychtoolbox/messages/](http://groups.yahoo.com/group/psychtoolbox/messages/)  
> \>   
> \> The Psychtoolbox Joystick functions link to SDL   
> ([http://www.libsdl.org/)](http://www.libsdl.org/)). SDL is released under the GNU Lesser   
> General Public License (LGPL), which requires that we meet certain   
> conditions ([http://www.libsdl.org/license.html)](http://www.libsdl.org/license.html)). One of those   
> conditions is that we include a copy of the LGPL license, which is in   
> the LGPL.txt file in this package. Also, to satisfy the license   
> terms: We agree to provide, upon request, the object code for the   
> compiled Psychtoolbox Joystick.dll function. The source code to   
> Joystick.dll is available under the same terms as the rest of the   
> Psychtoolbox, see [http://www.psychtoolbox.org/intro.html#copyright](http://www.psychtoolbox.org/intro.html#copyright) .  
> \>   
> \>   
> \>   
> \> Installation Instructions:  
> \>   
> \>   
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \_\_\_\_\_\_\_  
> \> CONTENTS OF ARCHIVE:  
> \>   
> \>   
> \> README.TXT -this text file  
> \> JoystickDemo -folder  
> \> PsychJoystick -folder  
> \> SDL.dll -dll file.  
> \> LGPL.txt -text file.  
> \>   
> \>   
> \>   
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \_\_\_\_\_\_\_  
> \> INSTALLATION:  
> \>   
> \> STEP 0:  
> \>   
> \> Uncompress the archive file Joystick\_Distrib.zip.   
> \>   
> \> STEP 1:  
> \>   
> \> Make sure that you have the Psychtoolbox for Windows installed on   
> your computer. If you do not, then you can get it here:  
> \> [http://www.psychtoolbox.org/download.html#psychtoolboxwin](http://www.psychtoolbox.org/download.html#psychtoolboxwin)  
> \>   
> \> STEP 2:  
> \>   
> \> Move the included "JoystickDemo" folder to your PsychDemos folder.   
> The path to your JoystickDemo folder should look something like:  
> \> C:\matlabR12\toolbox\PsychToolbox\PsychDemos\JoystickDemo  
> \>   
> \> STEP 3:  
> \>   
> \> Move the included "PsychJoystick" folder to you Psychtoolbox   
> folder. The path to PsychJoystick should look something like:  
> \> C:\matlabR12\toolbox\PsychToolbox\PsychJoystick  
> \>   
> \> STEP 4:  
> \>   
> \> Move the included SDL.dll file to the same directory as your   
> Matlab.exe file. The path to the file should look something like:  
> \> C:\matlabR12\bin\win32\SDL.dll  
> \>   
> \> STEP 5:  
> \>   
> \> Add these paths to your Matlab path. For instructions on how to   
> add files to your Matlab path, see your Matlab documentation.  
> \> C:\matlabR12\toolbox\PsychToolbox\PsychDemos\JoystickDemo  
> \> C:\matlabR12\toolbox\PsychToolbox\PsychJoystick  
> \>   
> \> STEP 6:  
> \>   
> \> If you have not installed Joysticks, follow the instruction   
> included with the USB joysticks.  
> \>   
> \> STEP 7:   
> \>   
> \> If you have Matlab 6.0 or greater, launch Matlab with the -nojvm   
> command line option. If you have Matlab version 5.x, just launch   
> Matlab. Type "JoystickDemo" in the Matlab command window and hit   
> the return/enter key.

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [May 22, 2003, 2:22pm UTC](https://psychtoolbox.discourse.group/t/joystick-functions-for-windows/1691/3 "2003-05-22T14:22:36Z")

</div>

Hello Allen W. Ingling,  
  
My name is Mury.  
I am MSc student of TU Delft (The Netherlands).  
I have also a problem with USB joystick.  
How to read the input USB joystick directly from SIMULINK window (not   
from MATLAB environment) ?  
Thanks in advance.  
  
Best regards,  
mury  
  
  
  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Allen W. Ingling"   
\<ingling@c...\> wrote:  

> \>   
> \> I have attached new functions for reading joysticks from within

Matlab  

> \> on Windows. They should work with any USB joystick with drivers for  
> \> Windows.  
> \>   
> \> The README.TXT file from the package is attached to this message, it  
> \> gives details.  
> \>   
> \> Allen  
> \>   
> \>   
> \>   
> \>   
> \>   
> \>   
> \> Distribution Notes for Psychtoolbox Joystick Functions for Windows.  
> \>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\_\_\_\_\_\_\_  

> \>   
> \>   
> \> The Joystick function will be included in the next release of the

Psychtoolbox, version 2.46. It is released separately, here in this   
package, ahead of the full Psychtoolbox version 2.46.   

> \>   
> \> The Joystick function should work with any USB joystick available

for Windows. It and JoystickDemo.m have been tested with the Gravis   
GamePad Pro USB and the Gravis Destroyer AfterShock joysticks in   
Matlab version 6.1, with Psychtoolbox version 2.45 under Windows   
2000.   

> \>   
> \> For bug reports and comments you may either contact the author,

Allen Ingling, or post a message to the Psychtoolbox Forum.  

> \> Allen Ingling: ingling@c...  
> \> Psychtoolbox Forum: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)   
> \> Psychtoolbox Forum online:

[http://groups.yahoo.com/group/psychtoolbox/messages/](http://groups.yahoo.com/group/psychtoolbox/messages/)  

> \>   
> \> The Psychtoolbox Joystick functions link to SDL

([http://www.libsdl.org/)](http://www.libsdl.org/)). SDL is released under the GNU Lesser   
General Public License (LGPL), which requires that we meet certain   
conditions ([http://www.libsdl.org/license.html)](http://www.libsdl.org/license.html)). One of those   
conditions is that we include a copy of the LGPL license, which is in   
the LGPL.txt file in this package. Also, to satisfy the license   
terms: We agree to provide, upon request, the object code for the   
compiled Psychtoolbox Joystick.dll function. The source code to   
Joystick.dll is available under the same terms as the rest of the   
Psychtoolbox, see [http://www.psychtoolbox.org/intro.html#copyright](http://www.psychtoolbox.org/intro.html#copyright) .  

> \>   
> \>   
> \>   
> \> Installation Instructions:  
> \>   
> \>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\_\_\_\_\_\_\_  

> \> CONTENTS OF ARCHIVE:  
> \>   
> \>   
> \> README.TXT -this text file  
> \> JoystickDemo -folder  
> \> PsychJoystick -folder  
> \> SDL.dll -dll file.  
> \> LGPL.txt -text file.  
> \>   
> \>   
> \>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\_\_\_\_\_\_\_  

> \> INSTALLATION:  
> \>   
> \> STEP 0:  
> \>   
> \> Uncompress the archive file Joystick\_Distrib.zip.   
> \>   
> \> STEP 1:  
> \>   
> \> Make sure that you have the Psychtoolbox for Windows installed on

your computer. If you do not, then you can get it here:  

> \> [http://www.psychtoolbox.org/download.html#psychtoolboxwin](http://www.psychtoolbox.org/download.html#psychtoolboxwin)  
> \>   
> \> STEP 2:  
> \>   
> \> Move the included "JoystickDemo" folder to your PsychDemos folder.

The path to your JoystickDemo folder should look something like:  

> \> C:\matlabR12\toolbox\PsychToolbox\PsychDemos\JoystickDemo  
> \>   
> \> STEP 3:  
> \>   
> \> Move the included "PsychJoystick" folder to you Psychtoolbox

folder. The path to PsychJoystick should look something like:  

> \> C:\matlabR12\toolbox\PsychToolbox\PsychJoystick  
> \>   
> \> STEP 4:  
> \>   
> \> Move the included SDL.dll file to the same directory as your

Matlab.exe file. The path to the file should look something like:  

> \> C:\matlabR12\bin\win32\SDL.dll  
> \>   
> \> STEP 5:  
> \>   
> \> Add these paths to your Matlab path. For instructions on how to

add files to your Matlab path, see your Matlab documentation.  

> \> C:\matlabR12\toolbox\PsychToolbox\PsychDemos\JoystickDemo  
> \> C:\matlabR12\toolbox\PsychToolbox\PsychJoystick  
> \>   
> \> STEP 6:  
> \>   
> \> If you have not installed Joysticks, follow the instruction

included with the USB joysticks.  

> \>   
> \> STEP 7:   
> \>   
> \> If you have Matlab 6.0 or greater, launch Matlab with the -nojvm

command line option. If you have Matlab version 5.x, just launch   
Matlab. Type "JoystickDemo" in the Matlab command window and hit   
the return/enter key.

---

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [May 22, 2003, 2:26pm UTC](https://psychtoolbox.discourse.group/t/joystick-functions-for-windows/1691/4 "2003-05-22T14:26:10Z")

</div>

hello Allen W. Ingling,  
  
Sorry, I forgot to tell you that the MATLAB Fcn (in simulink) isn't   
supported by Real-Time Workshop, since I want to run my Simulink   
Model in real-time (using Real-Time Workshop Toolbox).  
Thanks again...  
  
Regards,  
mury   
  
  
  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Allen W. Ingling"   
\<ingling@c...\> wrote:  

> \>   
> \> I have attached new functions for reading joysticks from within

Matlab  

> \> on Windows. They should work with any USB joystick with drivers for  
> \> Windows.  
> \>   
> \> The README.TXT file from the package is attached to this message, it  
> \> gives details.  
> \>   
> \> Allen  
> \>   
> \>   
> \>   
> \>   
> \>   
> \>   
> \> Distribution Notes for Psychtoolbox Joystick Functions for Windows.  
> \>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\_\_\_\_\_\_\_  

> \>   
> \>   
> \> The Joystick function will be included in the next release of the

Psychtoolbox, version 2.46. It is released separately, here in this   
package, ahead of the full Psychtoolbox version 2.46.   

> \>   
> \> The Joystick function should work with any USB joystick available

for Windows. It and JoystickDemo.m have been tested with the Gravis   
GamePad Pro USB and the Gravis Destroyer AfterShock joysticks in   
Matlab version 6.1, with Psychtoolbox version 2.45 under Windows   
2000.   

> \>   
> \> For bug reports and comments you may either contact the author,

Allen Ingling, or post a message to the Psychtoolbox Forum.  

> \> Allen Ingling: ingling@c...  
> \> Psychtoolbox Forum: [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com)   
> \> Psychtoolbox Forum online:

[http://groups.yahoo.com/group/psychtoolbox/messages/](http://groups.yahoo.com/group/psychtoolbox/messages/)  

> \>   
> \> The Psychtoolbox Joystick functions link to SDL

([http://www.libsdl.org/)](http://www.libsdl.org/)). SDL is released under the GNU Lesser   
General Public License (LGPL), which requires that we meet certain   
conditions ([http://www.libsdl.org/license.html)](http://www.libsdl.org/license.html)). One of those   
conditions is that we include a copy of the LGPL license, which is in   
the LGPL.txt file in this package. Also, to satisfy the license   
terms: We agree to provide, upon request, the object code for the   
compiled Psychtoolbox Joystick.dll function. The source code to   
Joystick.dll is available under the same terms as the rest of the   
Psychtoolbox, see [http://www.psychtoolbox.org/intro.html#copyright](http://www.psychtoolbox.org/intro.html#copyright) .  

> \>   
> \>   
> \>   
> \> Installation Instructions:  
> \>   
> \>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\_\_\_\_\_\_\_  

> \> CONTENTS OF ARCHIVE:  
> \>   
> \>   
> \> README.TXT -this text file  
> \> JoystickDemo -folder  
> \> PsychJoystick -folder  
> \> SDL.dll -dll file.  
> \> LGPL.txt -text file.  
> \>   
> \>   
> \>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\_\_\_\_\_\_\_  

> \> INSTALLATION:  
> \>   
> \> STEP 0:  
> \>   
> \> Uncompress the archive file Joystick\_Distrib.zip.   
> \>   
> \> STEP 1:  
> \>   
> \> Make sure that you have the Psychtoolbox for Windows installed on

your computer. If you do not, then you can get it here:  

> \> [http://www.psychtoolbox.org/download.html#psychtoolboxwin](http://www.psychtoolbox.org/download.html#psychtoolboxwin)  
> \>   
> \> STEP 2:  
> \>   
> \> Move the included "JoystickDemo" folder to your PsychDemos folder.

The path to your JoystickDemo folder should look something like:  

> \> C:\matlabR12\toolbox\PsychToolbox\PsychDemos\JoystickDemo  
> \>   
> \> STEP 3:  
> \>   
> \> Move the included "PsychJoystick" folder to you Psychtoolbox

folder. The path to PsychJoystick should look something like:  

> \> C:\matlabR12\toolbox\PsychToolbox\PsychJoystick  
> \>   
> \> STEP 4:  
> \>   
> \> Move the included SDL.dll file to the same directory as your

Matlab.exe file. The path to the file should look something like:  

> \> C:\matlabR12\bin\win32\SDL.dll  
> \>   
> \> STEP 5:  
> \>   
> \> Add these paths to your Matlab path. For instructions on how to

add files to your Matlab path, see your Matlab documentation.  

> \> C:\matlabR12\toolbox\PsychToolbox\PsychDemos\JoystickDemo  
> \> C:\matlabR12\toolbox\PsychToolbox\PsychJoystick  
> \>   
> \> STEP 6:  
> \>   
> \> If you have not installed Joysticks, follow the instruction

included with the USB joysticks.  

> \>   
> \> STEP 7:   
> \>   
> \> If you have Matlab 6.0 or greater, launch Matlab with the -nojvm

command line option. If you have Matlab version 5.x, just launch   
Matlab. Type "JoystickDemo" in the Matlab command window and hit   
the return/enter key.
