psychopy.org | Reference | Downloads | Github

Trigger with usb-parallele port adaptater


#1

helo everybody,
I’m medical studnet in Lille, France, ENT departement

OS : Windows 10
PsychoPy version : 3.0.6
**Standard Standalone? Y

**What are you trying to achieve?:

I try to get a score with audio stimulations and triggered my NIRS recorder to ich audio stimulation.
There is no parallele port on my researh computeur so i have an USB adaptater.
My question is how program the trigger to get out by my USB port?

thansks for your help.

Pierre emmanuel Lemesre


#2

Hi @Pierre-emmanuel_Leme, if you are trying to send a trigger to a device, have you thought about using a LabJack? PsychoPy supports LabJack hardware, and has a demo in the Coder Hardware demos to demonstrate how to set on up using Code. Also, see the PsychoPy documentation:

https://www.psychopy.org/api/hardware/labjack.html


#3

You could also use a USB2TTL8.

Sending an 8 bit digital output is pretty easy to do:

import serial

#Open connection to USB2TTL8 USB serial 
s = serial.Serial('/dev/cu.usbmodem1234567', baudrate=128000, timeout=0.01)

# Toggle TTL output to 255 for 5000 usec and then goto 0
s.write(b'WRITE 255 5000 0\n')

# or another example....

# Set digital output to 64 while stimulus is being drawn
# and to 128 while flip() is blocking
s.write(b'WRITE 64\n')
# draw stim
my_stim.draw()
s.write(b'WRITE 128\n')
win.flip()
s.write(b'WRITE 0\n')


Disclaimer: I make the USB2TTL8 so I am biased. :wink: