Track movement of multiple computer mice?
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Dwayne Bourgoyne
2024년 1월 2일
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).
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Instrument Connection and Communication에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!