Sending multiple triggers in one routine using parallel port


I am trying to send triggers to BrainVision through a parallel port. My experiment consists of many different images flashing briefly onscreen one after another. I am hoping to send triggers whenever a new image flashes on screen. It would be most convenient if I were able to send a different trigger for each different image category (faces, pareidolia, object). Below is the experiment in builder mode:

I’m not sure if this is necessary to mention here, but I am using a condition file for the experiment. I am including a snippet below:


I am also including my code below:

#Begin Experiment
from psychopy import parallel
p_port = parallel.ParallelPort(address=0x7F88)
#Begin Routine
pulse_sent = False  

pulse_terminated = True
#Each Frame
if Images.status == STARTED:
    if Images == 'pareidolia' or Images == 'face' or Images == 'object': #write your condition here - I didn't include any code for the status of the p_port component, only the keyboard response
          logging.log(level=logging.EXP, msg = 1) #print this in the logfile, you check the psychopy logfile timing compared to your output from the EEG marker file
          pulse_start_time = t
          pulse_sent = True
          pulse_terminated = False

# terminate the trigger at least 0.0167 ms (1 frames) later:
if pulse_sent and not pulse_terminated:
    if t - pulse_start_time >= 0.0167:
        pulse_terminated = True

The experiment runs perfectly, but there are no triggers being sent.

  1. How do I fix the code so that triggers are sent?
  2. Is it possible to send triggers through a parallel port using a conditions file? I’ve seen posts on using a serial port to do this, but not parallel ports.

Thank you!


I am still struggling with this, so any help would be greatly appreciated!

I can’t help except by posting what might be relevant threads.

After a long time of attempting to figure out this issue, I finally have resolved it, so I am posting it here for anyone who is having a similar problem! For reference, my stimuli consist of face, pareidolia, and object images. To align your triggers with your stimuli, I inserted the following code into the “Each Frame” code component.

And that worked for me! Turns out I was severely overcomplicating things.