How can I automatically detect and log changes to a USB joystick's position connected via vrjoystick?

1 Ansicht (letzte 30 Tage)
I have a USB joystick that I would like to record the position of at a high frequency in MATLAB 2017a.
I understand that I can get the position of the joystick (i.e., axes) using:
joy = vrjoystick(1);
[axes,buttons,povs] = read(joy);
I am currently using a timer callback to call this read function every 0.05 sec. However, the timer often does not achieve the appropriate frequency and sometimes 1 or more seconds will pass without the timer completing. I thus lose some data this way. Is there a way to improve the timer or to more efficiently query the position of the joystick? Perhaps there's a way to detect changes to the joystick position and write these directly to a file?

Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by