I’m not familiar with the button box, so I’m just going off the online documentation. They helpfully provide a PsychoPy example here:
but note that you shouldn’t use the
waitKeys() functions in a Builder experiment: they will conflict with Builder’s timing by inserting an indefinite pause while it waits for input. Instead you should use the
getKeys() functions that just check the current state of the button box rather than waiting for input.
In the “begin experiment” tab, put something like this to import the necessary software package and to connect to the box:
# import the rusocsci.buttonbox module
from rusocsci import buttonbox
# make a buttonbox
bb = buttonbox.Buttonbox()
Then in the “every frame” tab, you would use this function to check if a button is currently being pressed:
keys = bb.getKeys()
This then gives you a list of what buttons have been pressed at that instant. You will need to do something with that variable, as required.
I don’t think the
rusocsci package is included in PsychoPy (perhaps its should be…) So you will need to install it if the code above causes an error at the import stage. Do that by following the instructions here: