Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Trigger via USB

Hello everyone, I'm working on Opensesame, i'm making a dot probe task. But i need to insert trigger ( because i record an electroencephalogram) and i have a triggerbox ( brainproduct) but i don't know how insert trigger and how can I use Python to set up a serial device .

Can someone helps me ?
Thanks

Comments

  • edited June 2017

    Hi Tanghe,
    Having the trigger box is good news, because it is basically a virtual serial port. First, you want to make sure that the drivers are installed. You can use BrainProducts' own tool, which has the advantage of giving you the port address as well.

    Next, you'll need to set up the connection. I have only done this in PsychoPy using the parallel port, but it's all Python and can be done with a simple inline script at the beginning of your experiment.

    It would look something like:

    import serial
    exp.serial_port = serial.Serial('COMx')
    # Where x is the number of your port. 
    

    That should be all the setting up you need. Then during the trial you can write to the port, but I'm not sure of the exact command off the top of my head. (But probably something like exp.serial_port.write("1") for trigger 1. However, make sure to check the script to be sure!)

    Someone correct me if/where I'm wrong.

  • Hi Cesco,

    I ve tried this, it's worked, but for my trigger value , i ve just set a variable named tigger value ( because i've one trigger for one stimulus ).

    Thank you , have a nice day :smile:

Sign In or Register to comment.