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

조회 수: 1 (최근 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에서 Model Predictive Control Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by