Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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?

Réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by