# Precise Timing Parallel Port - Builder?

**URL:** <https://discourse.psychopy.org/t/precise-timing-parallel-port-builder/12618>\
**Category:** Builder\
**Created:** [April 21, 2020, 3:02pm UTC](https://discourse.psychopy.org/t/precise-timing-parallel-port-builder/12618 "2020-04-21T15:02:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![katpa](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@katpa](https://discourse.psychopy.org/u/katpa)\
**Post date:** [April 21, 2020, 3:02pm UTC](https://discourse.psychopy.org/t/precise-timing-parallel-port-builder/12618/1 "2020-04-21T15:02:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)\
**Post date:** [April 21, 2020, 3:38pm UTC](https://discourse.psychopy.org/t/precise-timing-parallel-port-builder/12618/2 "2020-04-21T15:38:06Z")

</div>

@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.

```auto
# 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](https://gitlab.pavlovia.org/dvbridges/psychopy2020stimtiming) and you can also read about PsychoPy timing precision and accuracy in the [timing mega-study](https://psyarxiv.com/d6nu5/).

---

<div class="post-metadata">

**Author:** ![katpa](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@katpa](https://discourse.psychopy.org/u/katpa)\
**Post date:** [April 21, 2020, 4:48pm UTC](https://discourse.psychopy.org/t/precise-timing-parallel-port-builder/12618/3 "2020-04-21T16:48:28Z")

</div>

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