psychopy.org | Reference | Downloads | Github

Yellow Traffic Light Task


#1

I am trying to recreate the yellow light task (traffic light is green, the g key is pressed and the light turns yellow, you have to anticipate when the light will turn red and release the key before it does) and i need to know the code for…
when the traffic light turns red (stimuli)and the key hasn’t been released a message saying “task failed”
and if the key has been released before the traffic light turns red the score appears ?
im using PsychoPy2.


#2

@C.Winchester, the ioHub keyboard component has a keypress and release function if you would like to give that a go - see here.

An easier option would be to use a mouse, because the mouse component has the getPressed function which returns whether or not a button is pressed - see here.

Or have you already got the response element sorted? If so, we can think about the logic of how your responses relate to color changes.