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:
#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.
How do I fix the code so that triggers are sent?
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.
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.