OS (e.g. Win10): Windows 10
PsychoPy version (e.g. 1.84.x): v2021.2.3
Standard Standalone? (y/n) If not then what?: y
**What are you trying to achieve?:
I want to differentiate the triggers sent for incorrect and non-responses for the Stroop task. My code successfully sends the specified trigger to the recorder for correct responses, but the problem is that although I have coded to send different triggers for incorrect and non-responses, the same trigger is sent in both cases. We are using the brainVision system. The code below is what I have written in “each frame” section:
if resp.corr == 0:
if resp.keys !='None':
resp.corr = 2
else:
resp.corr= 0
if (resp.keys == str(corrAns)) or (resp.keys == corrAns) and not mark_started:
port.write([0x10])
mark_start_time = globalClock.getTime()
mark_started = True
elif resp.corr == 2 and not mark_started:
port.write ([0x03]) # Sends S3 trigger
mark_start_time = globalClock.getTime()
mark_started = True
elif resp.corr == 0 and not mark_started:
port.write ([0x04]) # Sends S4 trigger
mark_start_time = globalClock.getTime()
mark_started = True
if mark_started and not mark_ended:
if globalClock.getTime() - mark_start_time >= 0.005:
port.write([0x00])
mark_ended = True
The first 5 lines, differentiates the incorrect and non-responses. I checked the csv output file and this code does what I need.
The problem has to do with elif parts of the code. It only sends S4 trigger for both the incorrect and correct responses. This happens even if I comment out the second elif codes. But, If I, for example, shut down the computer and turn it on and comment out the second elif codes and run the experiment, it will send S3. This time when I uncomment the second elif, it will only send S3 trigger for both cases. This shows that the problem originates from somewhere else.
What did you try to make it work?:
I have tried to differentiate the incorrect and non-responses in other ways, but they did not work.
I would be grateful if you could help us with this problem.
Thank you.