Sending response triggers via parallel port

Hello everyone,

I have created a task in Psychopy, which consists of a series of 180 symbol-digit pairs presented in two 9-minute blocks. At the start of each trial a legend containing a list of symbols matched to a corresponding number (from 1 to 9) will be displayed at the top of the screen for 6000 ms. Simultaneously with the appearance of the legend, a target symbol-digit pair is presented at the center of the screen for 4000 ms or until a response is given. The target is followed by a 2000 ms inter-stimulus interval. The participant is asked to judge, by looking at the legend, if the symbol-digit pair is correct (50% of the times) or incorrect. (50% of the times) by pressing the left or right arrow respectively.

I am trying to send EEG triggers via parallel port to Brain Vision Recorder. The triggers related to the stimuli display correctly, but I am having trouble with the triggers related to the participant’s responses. I am using a separate parallel port in the builder and code to specify the value for correct and incorrect responses, but unexpected green triggers with random names are appearing in Brain Vision Analyser at the same time as the stimulus triggers. This is causing issues with data analysis as some of these green triggers have the same name as the stimulus triggers.

I believe the problem is that the parallel port for responses in the builder starts at time 0 at the same time as the parallel port for stimuli. I want to link the response parallel port in the builder to the code and send a trigger only once a key is pressed. But I am not sure how to do it.

I would be very grateful for your help.
Thank you in advance!


Hi There,

You want the onset of your second trigger to be using a “condition” rather than time - see figure 2 in this guide - hope this helps!


1 Like

Hi Becca,

Thanks for the suggestion, it worked! However, I’m still having an issue where the experiment crashes if I don’t press a button after the stimulus presentation (a miss). I attempted to add code to prevent this, but so far it hasn’t worked. I’ve attached the code and parallel port image for reference.

Thank you,

Hi there,

I found the solution and I am sharing it here in case it proves helpful to anyone.
As @Becca was suggesting, I used a condition for the onset of the second trigger, relative to the response. Instead, for what concern the screen going completely black when no response was given, I think the problem was that the routine could not end since the parallel port couldn’t actually start if no response was given.
The solution that worked for me was adding:
In the Begin Experiment section: trialclock = core.Clock()
In the Begine Routine section: trialclock.reset()
In Each Frame: t = trialclock.getTime()
if t >= 3:
continueRoutine = False

In this way, if the time elapses 3 seconds (just an example), which is checked at each frame, the routine should end even if no respose is given.

Hope it helps,