Sending EEG Triggers in PsychoPy with several conditions

Hello everyone,

I am working on a PsychoPy experiment that I would like to synchronize with an EEG system from ANT Neuro , using a USB2TTL8 serial cable to send triggers. However, I am having trouble correctly implementing the triggers, and I would really appreciate some help!

OS: Win10
Psychopy2023.2.3

Each trial consists of the following sequence:

  1. An image appears on the screen (two possible conditions: AS or Neutral).
  2. The participant must choose between two options: Reappraisal or Distract.
  3. The same image reappears for a few seconds.
  4. The participant rates the valence of the image.

I have attached images of my PsychoPy workflow to illustrate the structure.

I want to send different EEG triggers based on:

  1. The condition of the image (AS vs. Neutral).
  2. Whether it is the first or second appearance of the image in a given trial.

Example of expected triggers:

  • Neutral Condition:
    • First appearance (Image_1) → Trigger 10
    • Second appearance (Image_2) → Trigger 20
  • AS Condition:
    • First appearance (Image_1) → Trigger 30
    • Second appearance (Image_2) → Trigger 40

One potential difficulty is that my "Trial_2" routine is duplicated and linked to two different loops:

  • “boucle_essai” (linked to Essai.xlsx)
  • “boucle_trial” (linked to Trial.xlsx)

Each loop is associated with a different Excel file, and I am not sure if this duplication is causing issues with the trigger implementation.

I am struggling to properly send and differentiate the triggers, and I am unsure how to best structure my PsychoPy script given the duplicated routine. I would really appreciate any advice or guidance on:

  1. How to correctly send different triggers based on image condition (AS/Neutral) and first vs. second appearance.
  2. How to manage the duplicated “Trial_2” routine across two loops without causing conflicts.
  3. Any example code or best practices for sending triggers via USB2TTL8 in PsychoPy.

I would be very grateful for any help or suggestions! Thank you in advance for your time.