I’m doing an EEG experiment using PsychPy and BrainVision Software. The computers are connected via parallel port (BrainVision trigger box).
The task consists in images presentation.
I dont’ know how to send a trigger from psychopy to the BrainAmp… and a bit clueless.
I try to insert a I/O parallel port component, defining like that the element of the component
The trigger box is emulating a serial port (COM port on Windows) and you have to send trigger signals via serial port. I am not experienced with the “Builder” but perhaps you can insert a code component. See the official example by Brain Products below:
import serial
import time
import threading
Connected = True
PulseWidth = 0.01
def ReadThread(port):
while Connected:
if port.inWaiting() > 0:
print "0x%X"%ord(port.read(1))
# Open the Windows device manager, search for the "TriggerBox VirtualSerial Port (COM6)"
# in "Ports /COM & LPT)" and enter the COM port number in the constructor.
port = serial.Serial("COM6")
# Start the read thread
thread = threading.Thread(target=ReadThread, args=(port,))
thread.start()
# Set the port to an initial state
port.write([0x00])
time.sleep(PulseWidth)
# Set Bit 0, Pin 2 of the Output(to Amp) connector
port.write([0x01])
time.sleep(PulseWidth)
# Reset Bit 0, Pin 2 of the Output(to Amp) connector
port.write([0x00])
time.sleep(PulseWidth)
# Reset the port to its default state
port.write([0xFF])
time.sleep(PulseWidth)
# Terminate the read thread
Connected = False
thread.join(1.0)
# Close the serial port
port.close()
It worked out! it was just a typo. Now one trigger is working! Now, I have the question: How do you put in the task more than one trigger? what numbers one should put here in port.write([0x01]) and in which tabs? I need three triggers for my task.
@Leidy you determine the trigger value with this part: 0x01 … simply replace that with 0x02, 0x03, 0x04, etc. and don’t forget to reset to 0x00 after sending a trigger (as shown in the example I posted).
I don’t really understand what you mean by “in which tabs”. Does that relate to the Builder?