
- #Building experiments in psychopy for sale how to#
- #Building experiments in psychopy for sale serial#
The cookie is used to store the user consent for the cookies in the category "Analytics".

This cookie is set by GDPR Cookie Consent plugin. These cookies ensure basic functionalities and security features of the website, anonymously. Necessary cookies are absolutely essential for the website to function properly. Please visit source website for post related comments. For instance, AABBAA is fine, but ABABAB is not. The triggers for block sections had to be send consecutively because the triggers cannot be interspersed (not sure if that’s because of my settings).
#Building experiments in psychopy for sale serial#
Here is an example of an experiment using serial port triggers to delimit blocks of stimuli and individual stimuli.ĭue to the sampling rate, I had to add delay between the triggers delimiting the blocks, otherwise they would not be captured accurately. The next step is adding the triggers for the beginning, each stimulus/block, and the end of recording. If the triggers work as expected, the code sections for serial triggers can be embedded in the experiment. Once the test is started, you can run the Python script to test whether the serial signals are coming through. The easiest way for me to test whether I was sending correct signals was to use the Communication Test in the External tab (see the second screenshot). it was on the list previously set up in Parameter/Stim Measurement: That was one of the strings expected by ETG-4000, i.e. In this example, it is “A ” followed by Python’s string literal for a Carriage Return. The last line of the script is sending the signal through the serial port. The second argument is the Baud rate, it should be the same as the Baud rate used in the Parameter/External settings of the ETG-4000:

The argument (‘COM1’) is the name of the serial port used.

To better understand the arguments of the serial.Serial class please consult the pySerial documentation. After a quick brainstorm with the lab technician, we figured out that a simple script (see below) is indeed sending triggers to the fNIRS:
#Building experiments in psychopy for sale how to#
Luckily, the PsychoPy tutorial has a section about using a serial port, but after reading this I still wasn’t sure how to use the code with my script. I wrote this tutorial so that others (and future me) won’t have to waste time reinventing the wheel.Īfter creating an initial version of my experiment (looping over a wav file) I tried to figure out how to send a relevant trigger to my fNIRS. In the process of designing my latest experiment in PsychoPy I realised that setting up the serial port connection is not the most obvious thing to do.
