Hello,
I am running PsychToolbox-3 on Windows 10 and MATLAB R2020b. We are using two Current Designs 2-button Button Boxes, one for each hand. Our experiment worked completely fine for months, until one day it just randomly broke - no errors or changes to anything. Now, KbStrokeWait randomly captures/prints only some of the button presses. Other button presses are not captured/printed as PsychToolbox is unresponsive and the experiment cannot progress. I have included the first instance in which KbStrokeWait is used.
text = ['Welcome to the experiment!\nThe experiment takes about 60 minutes to complete on average.\n' ...
'\nSome people will take more time and some people will take less time.' ...
'\nPress any button to continue.'];
DrawFormattedText(screenInfo.curWindow, text, 'center','center', white);
Screen('Flip', screenInfo.curWindow);
[~, keyCode, ~] = KbStrokeWait(-1); %Experiment randomly and unexpectedly gets caught here, even when buttons are being pressed
disp(KbName(find(keyCode))); % for debugging
I have determined that it is not a hardware issue with the computer, button boxes, or any cables. It also doesn’t seem to be an issue with MATLAB itself. When debugging, I can see that the program is getting caught at line 118 in KbWait.m (which KbStrokeWait uses):
<117> % Wait for keypress:
<118> [secs, keyCode, deltaSecs] = KbWait(deviceNumber, 0, untilTime);
No error is shown, and when pressing buttons using KbStrokeWait outside of our experiment (i.e. in the command prompt), each button press is recorded. Additionally, when using the keyboard instead of the button boxes, every keypress goes through. No other lab that uses these button boxes has had a problem with them. I have tried everything I can think of, from reinstalling MATLAB, Psychtoolbox, updating Windows, restricting & disabling keys, using KbWait/KbPressWait, to no avail. Please let me know if you have any ideas.