psychopy.org | Reference | Downloads | Github

Sending triggers to BIOPAC via USB ttl Module (BlackBoxToolkit)

OS : Win 10 64bit
PsychoPy version : 3.2.4
**Standard Standalone?: YES
What are you trying to achieve?:

Send triggers from psychopy to the MP150 BIOPAC using the USB TTL Module from BlackBoxTooklit.

What did you try to make it work?:
I followed the instructions provided for using the USB TTL Module with psychopy, specifically, using a code component I use at beginning of the experiment section
import serial
ser = serial.Serial("COM5",115200, timeout=1)

and under the begin routine, to send a trigger to Hardware I use
ser.write('01')

And for End Routine I use
`ser.write(‘00’)

I double checked the the module is indeed working using their validation software as well.

What specifically went wrong when you tried that?:
I am getting an error suggesting that this is not being sent as a byte
Traceback (most recent call last): File "C:\Users\hc122\Desktop\InteroStudy2019\interostudynov26_iaps_lastrun.py", line 595, in <module> ser.write('01') File "C:\Program Files\PsychoPy3\lib\site-packages\serial\serialwin32.py", line 308, in write data = to_bytes(data) File "C:\Program Files\PsychoPy3\lib\site-packages\serial\serialutil.py", line 63, in to_bytes raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq)) TypeError: unicode strings are not supported, please encode to bytes: '01'

I am not quite sure if there was a change in the way psychopy uses these functionalities, as this is exactly what the manual says and I don’t see where this goes wrong.

I would be very grateful for any pointers!

Thank you
Helio