1
% DaqWaitButtonDumbTest1408FS.m
3
% A quick and dirty demo on how to poll the digital inputs
4
% of a USB-1408FS as fast as possible, without overhead.
6
% This is essentially a stripped down version of DaqDIn() with
7
% some polling loops wrapped around and a options.secs value of
8
% zero for essentially polling with no timeout.
17
% Windows needs some minimal polling time:
23
PsychHID('ReceiveReportsStop',daq);
24
PsychHID('GiveMeReports',daq);
25
PsychHID('ReceiveReports',daq, options);
28
% Emit query to device:
29
PsychHID('SetReport',daq,2,reportId, TheReport);
31
% Wait for result from device:
33
while isempty(inreport)
34
% Yield some minimum amount of time to other processes if you want to be
35
WaitSecs('YieldSecs', 0);
37
inreport = PsychHID('GetReport',daq,1,reportId,NumberOfPorts+1);
40
% inreport contains latest button query result: Button pressed?
46
% No. Repeat sampling...
49
fprintf('Change detected! Bye.\n');