Time out for incorrect responses

Hello, I am trying to add a 6 second timeout when participants respond incorrectly. I already added code to print “correct” or “incorrect” based on their responses, but I am not sure how I would add a timeout if incorrect? The code I have so far is below. Thanks!

if key_resp_4.corr:
respond = ‘Correct!’
else:
respond = ‘Incorrect.’

You can add a component in the feedback routine (or in a separate routine) with a variable as a duration (e.g. $TimeOut) set to change every repeat, then you can modify your code component:

if key_resp_4.corr:
   respond = ‘Correct!’
   TimeOut = 0
else:
   respond = ‘Incorrect.’
   TimeOut = 6
2 Likes