Effacer les filtres
Effacer les filtres

Track movement of multiple computer mice?

2 vues (au cours des 30 derniers jours)
Patrick Parker
Patrick Parker le 18 Jan 2016
I want to track the movement of multiple computer mice, none of which are my cursor. The mice connect using USB ports. Can this be done using VISA? Is there a better way to do this?
I've built drivers for each computer mouse through National Instruments and I've confirmed they work in LabView. I can create a VISA-generic object for each mouse, as well as turn recording status 'on' and the transfer status to 'read.'
Mouse1 = visa('ni', 'USB0::0x046D::0xC07E::878C367F5351::RAW');
fopen(Mouse1);
Mouse1.RecordName = 'filename.txt';
readasync(Mouse1)
record(Mouse1,'on')
Mouse1
VISA-Generic Object Using NI Adaptor : USB0::0x046D::0xC07E::878C367F5351::0::RAW
Communication Address
Resource Address: USB0::0x046D::0xC07E::878C367F5351::0::RAW
Communication State
Status: open
RecordStatus: on
Read/Write State
TransferStatus: read
BytesAvailable: 0
ValuesReceived: 0
ValuesSent: 0
record(Mouse1,'off')
stopasync(Mouse1)
I believe the data should be binary, though when I try access it, I get a warning:
fread(Mouse1)
Warning: Unsuccessful read: VISA: Unable to start operation because setup is
invalid (due to attributes being set to an inconsistent state).
ans =
Empty matrix: 1-by-0
I'm unsure what I'm doing incorrectly in my setup. Any advice?
Thanks.
p.s.- I have the instrument control toolbox for Matlab. Also, I can perform this in LabView, though it will be easier to sink with other data if I can run everything within Matlab.
  1 commentaire
Dwayne Bourgoyne
Dwayne Bourgoyne le 2 Jan 2024
I am very interested in your progress. I am working on a computer assignment for my classroom and would like to be able to use indpendent multiple mice (mouses).

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Instrument Connection and Communication dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by