Parallel Port EEG Multiple Triggers

Hi everyone,

Thanks in advance to whom will contribute to this discussion.

OS: Windows

What is the problem?
I’ve run an experiment with an EEG system sending triggers through a serial port. I now need to run the same experiment with a different population, but I need to switch to another EEG system that uses a parallel port. I am a bit lost as I don’t find information that suits my problem, that is, how to send different triggers for different conditions through code components, using a parallel port.

The task
The task is composed by the presentation of four pictures for each trial, presented at the four peripheral points of the screen. Each trial contains pictures of the same condition (conditions are three: Neutral, Happy, Fearful). Throughout the task, a fixation cross is presented at the center of the screen, and occasionally, during the inter-stimulus interval its size changes (either the vertical or the horizontal line became longer). Participants have to press the space bar as soon as they detect a change in dimension. If they do so within .5 seconds it’s a hit, otherwise a miss.
The triggers codifies each condition, the change of the fixation cross and participants’ response. Triggers for each condition are specified in the “trigger” column of my condition file.

What did I try?
I apologize in advance, but I haven’t tried anything as I don’t even know where to start with the changes…

How are my triggers coded as of right now?

At the beginning of the experiment, in "Begin Experiment":
import serial
port = serial.Serial('COM5')

#For the cross:
#Begin Routine
cross_iti_pulse_started = False
cross_iti_pulse_ended = False

#Each Frame
if myclock.getTime() >= next_time and myclock.getTime() > ITI_start_time + 0.25 and  myclock.getTime() < ITI_start_time + 0.7 and not cross_iti_pulse_started: #ITI_start_time + 0.25 to allow the static component to upload the pictures. ITI_start_time + 0.7 to avoid the cross to change close to the trial
    win.callOnFlip(port.write, [5])
    cross_iti_pulse_start_time = globalClock.getTime()
    cross_iti_pulse_started  = True

if cross_iti_pulse_started and not cross_iti_pulse_ended:
    if globalClock.getTime() - cross_iti_pulse_start_time >= 0.005:
        win.callOnFlip(port.write,  [0])
        cross_iti_pulse_ended = True

#For key press
#Begin Routine
resp_iti_pulse_started = False
resp_iti_pulse_ended = False
CountedKeys1 = 0

#Each Frame
if len(key_resp_iti.keys) > CountedKeys1 and not resp_iti_pulse_started:
    CountedKeys1 += +1
    win.callOnFlip(port.write, [7])
    resp_iti_pulse_start_time = globalClock.getTime()
    resp_iti_pulse_started  = True

if resp_iti_pulse_started and not resp_iti_pulse_ended:
    if globalClock.getTime() - resp_iti_pulse_start_time >= 0.005:
        win.callOnFlip(port.write,  [0])
        resp_iti_pulse_ended = True

#For pictures
#Begin Routine
stimulus_pulse_started = False
stimulus_pulse_ended = False

#Each Frame
if all(x == STARTED for x in [topleft.status, topright.status, bottomleft.status, bottomright.status]):
    if not stimulus_pulse_started:
        win.callOnFlip(port.write, [triggers])
        stimulus_pulse_start_time = globalClock.getTime()
        stimulus_pulse_started  = True

if stimulus_pulse_started and not stimulus_pulse_ended:
    if globalClock.getTime() - stimulus_pulse_start_time >= 0.005:
        win.callOnFlip(port.write,  [0])
        stimulus_pulse_ended = True

#End Experiment

Attached you can find screens of the experiment structure and of the condition file.

Thank you very much!