Simultaneous key response

We are trying to program a task in which the routine ends when 6 keys are pressed more or less simultaneously.

We found a solution by introducing a code (see below).
‘’‘if resp1.status == STARTED:
theseKeys = resp1.getKeys(keyList=Touches, waitRelease=False)
_resp1_allKeys.extend(theseKeys)
if len(resp1.keys) > 5:
resp1.keys = [key.name for key in _resp1_allKeys]
resp1.rt = [key.rt for key in _resp1_allKeys]
if (resp1.rt[-1] - resp1.rt[0]) < abs(0.1):
# a response ends the routine
continueRoutine = False
else:
continueRoutine = True
resp1.keys = []
resp1.rt = []
_resp1_allKeys = []
resp1.status = STARTED’’’

It works with 4 keys. However, when extended the number of keys to 5 or 6, it doesn’t work for some combinations of keys (this is not a problem of qwerty/azerty keyboard). We don’t understand why it works for some combinations of letters and not for some others.

Does anybody have an idea which could help us to understand the problem.

1 Like

Hello Lola,
this may actually be a problem of the keyboard: if your keyboard has not an anti-ghosting tech, pressing several keys (generally 5/6 or more, depending on the keyboard) may not work. You can check the possibilities of your keyboard easily, by pressing several keys simultaneously when you’re working in a text editor. Your can also check for different key-combinations, some combinations of 6 keys may work while other combinations won’t work.
A super-gamer keyboard with the anti-ghosting tech could solve this issue.

3 Likes

Thansk a lot Anezka.