psychopy.org | Reference | Downloads | Github

How to set a keyboard press two time and record the response time

If this template helps then use it. If not then just delete and start from scratch.

OS (Win10):
**PsychoPy version 2020.2.10:

You could use two identical routines with one keyboard component each. Alternatively you can use a single routine and a code component instead of a keyboard component:

#In the begin routine tab
myCounter = 0 #the number of times you pressed the keyboard
timer = core.Clock() #sets a timer for RT

#In the each frame tab
myKeyPress = event.getKeys('return') #you can swap "return" for any key
if 'return' in myKeyPress: # when RETURN is pressed 
    timekey = timer.getTime()
    thisExp.addData("RT", timekey) #record the RT
    myCounter = myCounter + 1 #add 1 to the number of keypresses
    if myCounter > 1: #if you pressed the keyboard two times
            continueRoutine = False; #end the current routine