Sending markers to EEG through serial port

Hi Leidy,

Sorry for the late reply, I didn’t realise there was a question here. Hope you have found a solution to proceed.

Anyway, here are my codes:

Begin Experiment:
#the port number should depend on your lab’s setting.

 import serial
 port = serial.Serial(port = 'COM4', baudrate = 9600)

Begin routine:

trigger_sent = False

Each frame:
#so the trigger is sent 1.032s after the routine starts, same onset as the picture stimuli # ConditionCode is the variable listed in the TrialList to distinguish conditions

if t >= 1.032 and not trigger_sent:
port.write(str.encode(chr(ConditionCode)))
trigger_sent = True

End experiment:

port.close()

Cheers,
Linda