Sending multiple triggers in one routine using parallel port

Hello,

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:

image

I am also including my code below:

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

p_port.setData(0) 
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
          p_port.setData(1) 
          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:
        p_port.setData(0)
        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!

Hello!

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.