psychopy.org | Reference | Downloads | Github

Sequential keypresses

Dear all,

I am trying to build an experiment in which participants have to perform a finger tapping sequence after seeing a colored fixation cross. For example, they see a red + and they have to tap the number “1” and “2”, one after the other. I attach here the relevant files: Mental_Rep_1.py (25.3 KB) Mental_Rep_1.psyexp (20.7 KB)

This is how exemplary conditions look like:
word (+) color(red) corrAns(1) corrAns2(2)
conditions.xlsx (4.8 KB)

What I have tried to apply is this (as found in a previous thread):

check for quit:

            if "escape" in theseKeys:
                endExpNow = True
            if len(theseKeys) == 2:  # at least two keys are pressed
                trainingresp.keys.extend(theseKeys)  # storing all keys
                trainingresp.rt.append(trainingresp.clock.getTime())
                # was this 'correct'?
                if (trainingresp.keys and trainingresp.keys == [corrAns, corrAns2]):
                    trainingresp.corr = 1
                else:
                    trainingresp.corr = 0
                # a response ends the routine
                continueRoutine = False

I want to force them to press two buttons, that´s why I have len==2.
What happens now when I try to run the experiment is that it stops at the first stimulus and I have to force the exit.

Also as a secondary thing: is it possible to add a feedback of the type “This is wrong, the sequence is not X-Y, but 1-2”. Where X-Y are the buttons pressed by the subject.

Thanks in advance.