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).
Track movement of multiple computer mice?
5 次查看(过去 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.
回答(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!