How can I send triggers that encode an ID?

OS (e.g. Win10): 10
PsychoPy version (e.g. 1.84.x): 2020.2.4
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
Hi, I am using short videos stimulation and Biosemi Activettwo to collect the EEGs. I need to send some markers every time a video begins and ends. Since I will display more than 2000 videos every trigger need to encode the movieID (In the beginning and in the end).
So far, I can send the triggers every time the video begins and ends. But I am struggling to encode the movieID in each trigger. Here is a real example of the excel I am using.

What did you try to make it work?:
In the “Begin routine” tab I have tried:

Import serial
port= serial.serial(‘com4’, baudrate=115200)
port.write(b’$movieid’) - send 7 random trigger inputs
port.write(bytes(’$movieid)) - send 7 random trigger inputs.
port.write(bytes(str($movieid))) - doesn’t work

I also set the ID with a “text format” in the excel file but didn’t work.

¿Is there another way to label my videos? If not, How can I code the triggers to send the movieID I want?

Any help will be really appreciated.


I miss one thing. The videos are display randomly.

Hello Felix

you might want to look here. From reading this post, I suspect that your code is incorrect. I conclude that it should be


Sorry, I have no way of testing it.

Best wishes Jens