send trigger via virtual serial port using an adapter/trigger box for parallel port
Dear folks,
i must admit that i am a complete noob in sending triggers. π
I have put an adapter to my parallel port. This makes it possible to connect it with any computer via USB. This adapter makes the system believe it is connected via serial port 'COM6' ;)
I used an old script from 2014 which was written by Edwin and tried to adapt it with the modern python codes/OS version. Well, of course this did not work. I am not sure whether i was close or whether i missed something. I did not receive any error messages, but i did not see any triggers in the BrainVision Recorder neither. In other posts it was mentioned that triggers are only send if they changed. So i tried to send 3 triggers. I also tried to implement what i found here. This is my code:
# we will need to import the 'serial' module, # which allows us to send and receive # information via the serial port import serial #checkout which ports are available #serial.tools.list_ports #does not work this way # next, we will need to start a connection to # the serial port #var.trigger = serial.Serial('COM3') trigger = serial.Serial() trigger.port = 'COM6' trigger.open() trigger.write(0) trigger.read() # finally, we want to make sure that the # connection to the serial port will be stopped # when the experiment is aborted or finished var.cleanup_functions.append(trigger.close) # this sends a trigger with value 0 # if you require a different value, please # use a number between 0 and 255 trigger.is_open trigger.write(0) trigger.readline() #send stim with picture keepQuiet=canvas() path = pool['keepQuiet.tif'] keepQuiet.image(path) keepQuiet.show() #send trigger to other computer trigger.write(1) trigger.readline() #get response enter = keyboard(keylist = ['RETURN']) key, time=enter.get_key() #send response trigger mber between 0 and 255 trigger.write(255) trigger.readline()
Comments
Further i found python codes from BrainVision. However, i do not know what to do with it:
It runs without error messages and gives my some debug output:
Any suggestions, how i can get and see the triggers in the Recorder? It works fine for a colleague who uses presentation. So the hardware is correctly connected. ;)
after 2 weeks of intensive trying:
i had to install the drivers for the parallel port adapter from neurospec. π€£
With the correct driver, the neurospec adapter, BrainVision Recorder, BrainVision ActiChamp and OpenSesame 3.2.8 it works! π€
This is my final code which did send triggers.