How can I connect a gamepad to MatLab?
27 views (last 30 days)
Show older comments
I should connect to Matlab a keyboard that is ridden by the pc as a Gamepad (I checked that it’s already installed and recognised by the pc using a tester). According to the instructions I have, I first typed daqregister('joy') in the command window for register the dll. Using Matlab 2016b was not working, so as I read in a forum I downloaded an older 32 bit version (first the 2013b then the 2011b) and it worked showing me: ans =
'joy.dll' successfully registered.
Then I typed the analoginput('joy',ID) function but it appeared:
Error using analoginput (line 142) Invalid enum value.
I tried to put as (ID) different numbers , seen that it should be 1, but with the same results. Do someone know how could I solve the problem? Or if not if there is just another way to make MatLab read the joypad? Thanks a lot.
0 Comments
Answers (1)
Arnav Mendiratta
on 12 Jun 2017
"daqregister" is an old way of registering and using Analog devices within MATLAB. This functionality has been removed since MATLAB R2016a. Since the newer release, you do not need to register an adaptor (which is what "daqregister" was used for) if you are using session-based interface. If you are using newer release, I recommend setting up your device by following the steps as described in the documentation here:
https://www.mathworks.com/help/daq/hardware-discovery-and-session-setup.html
I also recommend going through this short video if you are looking to integrate a gamepad controller with a Simulink model.
0 Comments
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!