Hello everyone!
I try to record the key response during a while loop. To condense multiple ‘keyDown’ events into a single event (because participants may press a key slowly), I use “KbReleaseWait” in my code. It worked fine for the keyboard of the Mac, but it failed for my second keyboard (connect with MAC through Bluetooth). Participants should use the extra keyboard, so I cannot remove it. I have tried several keyboards, but they all failed. I also used " while KbCheck; end" instead of “KbReleaseWait”, it failed again.
Does anyone know how I can fix this problem?
Thanks!
Do you get keypresses at all from that keyboard, e.g. with our demos? The forum is full of posts about Keyboard trouble with the Mac, have a look. Make sure you update PTB
Hi, dcnieho!
The second keyboard works well. The problem is I got only one response when pressed the key on the first keyboard (Mac’s own, and this is what I want), while I got multiple responses when I pressed the key on the second keyboard.
I have read several posts, like using KbQueue instead of KbCheck, I will check more posts. PTB is already the newest version.
Thanks you very much!
It’s a classic problem encountered and solved many times on the forum, and ofc. in our help texts. Look at the help for KbCheck
and other keyboard functions and the description of the deviceIndex
parameter on how to select the keyboard you want to use for input.
Step 1 if something doesn’t work should always be “Read the help text for the function you think doesn’t work carefully and understand how to use it”, because the vast majority of all reported problems with basic PTB functionality are always “User can’t (be bothered to) read”, “user error”, or “operating system / device driver bug”. The OS bug problem is best solved by upgrading to Linux with recommended hardware.
-mario
Hi mario,
Thank you for your advice. I reread the description about KbCheck, and indeed, deviceIndex solved my problem.
I will keep your word in mind next time when I encounter some bugs.
Thank you very much!