psychopy.org | Reference | Downloads | Github

Precise Timing Parallel Port - Builder?

Dear all!

I am trying to send triggers to EEG via a parallel port. For the experiment it is very important that the triggers are sent with the onset of a visual stimulus (or at least with a constant delayed across all trials). Do you have any recomendations how to achieve this? I read that with the coder, you could do it with the flip() commands, however, as this is a collaborative and student project, I need to get it working in the builder too.

Thank you so much
Kat

@katpa, you could use something like the following, used for synchronising a TTL pulse with visual stim onset with a USB2TTL8 by Labhackers. The TTL was synchronised to appear with the onset of a polygon.

# Begin Experiment
sconn = # YOUR TTL HARDWARE 
ttl = {'status': NOT_STARTED}  # A dict for saving the TTL start stop status

# Each Frame
if polygon.status == STARTED and ttl['status'] == NOT_STARTED:
    ttl['status'] = STARTED
    # Send TTL pulse on the next screen refresh, when polygon is drawn
    win.callOnFlip(sconn.write, b"WRITE 255\n")

The code repository is here and you can also read about PsychoPy timing precision and accuracy in the timing mega-study.

Great! This was exactly what I was looking for! Thank you so much for your quick help!
:slight_smile: