How do I make my program accept inputs from an xbox 360 controller and store the input? Script already wrote.

3 次查看(过去 30 天)
Hey, so I made this nuclear casuality estimator for my maths uni matlab project. Instead of the user typing in the numbers eg altitude, yield etc, how can I make the xbox (wired) controller axis joysticks be used to put in the input? Eg raise left joystick axis up and it raises the number, then they press the b button and it goes to the next part of the script. Here is an example of some of my code and a video of the program.
Example of my code: ------------------------------------------------------------------------------------------------------------------- altitude = 'Please enter the altitude in metres you wish to detonate: '; altitude = input(altitude); if (altitude<=100); tts('This is an aerial burst estimator, please enter a number greater than 100 metres.'); disp(' ') disp('This is an aerial burst estimator, please enter a number greater than 100 metres.') return end if (altitude>100000); tts('The Test Ban Treaty of 1963 prohibits nuclear weapons tests "or any other nuclear explosion in the atmosphere, in outer space, and under water.'); disp(' ') disp('The Test Ban Treaty of 1963 prohibits nuclear weapons tests "or any other nuclear explosion"') disp('in the atmosphere, in outer space, and under water.') return end
------------------------------------------------------------------------------------------------------------------- So, how can I make it so that the joystick can be used as the input there instead of typing in a number? My intention is to strip the controller apart after and then make a project box so I can figure out haptic feedback to make it more interactive. I messed with vrjoystick, but ive been scratching my head for weeks. I even bought this to make a final throw switch...(once ive stripped the xbox 360 wired controller down).
http://www.ebay.co.uk/itm/321921452867?_trksid=p2057872.m2749.l2649&var=510866888023&ssPageName=STRK%3AMEBIDX%3AIT (I want that to basically be like pressing the enter key, but routed via the xbox controller).
My program (Has EMP simulation, lol)
https://www.youtube.com/watch?v=EUpjJeviHz8

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Stochastic Differential Equation (SDE) Models 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by