Hi Evryone,
Im using a windows 10 and psychopy 3 to create a lexical decision task. the task is done, and Im just adding the triggers and serial port.
The USB serial port I’m using is this one
and I download the driver that was on the Biosemi web page. This port is recognized in my computer as COM 3
So I want to know what Im doing wrong, Im following all the steps but there are no videos available in youtube and all the answers here are related to coding and I don’t know how to code in python.
I install the same driver in other computer and try the experiment with e prime and triggers work, but i don’t want to use E-prime (to expensive)
Please, I need help ASAP
Thanks!
Unfortunately the parallel port component doesn’t yet support communication with the serial port. You will need to use a code component something like this
import serial
#serial port settings - Begin Experiment tab in a code component
s_port = serial.Serial() #serial port name
s_port.port = 'COM3' # chosen serial port
s_port.timeout = 1 # timeout 1 second (give 1 second to the board to initialize port)
s_port.open() #open serial port to start routine
# to mark the trigger - Each frame tab of code component (note you will probably need an if statement to make sure onset it the time you want)
win.callOnFlip(s_port.write, str.encode('1'))# where '1' is the start value
# to stop the trigger- Each frame tab of code component (note you will probably need an if statement to make sure offset it the time you want)
win.callOnFlip(s_port.write, str.encode('0'))# where '0' is the stop value
- end experiment tab
s_port.close() #in the end the serial port must be closed
Hi Becca,
I managed to send triggers from psychopy to activeview. The only problem is that I need the triggers to be 1, 2 and 3 , but I only get the same.
I have this
So I’m doing a stroop task, and every time the participant answers, I need that trigger to be sent to activeview.im using a biosemi EEG seria port to send triggers from psychopy to activeview. What I need to know is how to make sure that the triggers are the ones that I need. For example, In a Stroop task, I have two types of triggers, 1, for condition A and 2 for condition B.
What do I need to add to my script to make sure that responses are connected to the trigger?
Thanks.
Do you only want the trigger to mark the onset or be sent throughout the duration of something? if so you don’t need it in the each frame tab (at the moment the trigger send in your Begin Routine tab will correspond to the unique trigger label, but the triggers sent in Each Frame will still be 1)
Sorry, my English and coding language is not that good!
so what I need is the trigger to be sent to activeview when the participant answers or press the correct key, in this case, if the word is a congruent condition, it needs to be trigger 1 and if they answer an incongruent condition trigger 2
or in a lexical decision task, if they answer A for words, the trigger needs to be 1 and if they answer L for non-words, the trigger needs to be 2. This needs to happen only when the participant press the key does this make sense? while they see the prime word or while they are in a break, no triggers need to be send, just at the moment when the stimuli is answered
and for the test part, the code is the same, except that i didn’t include anything in the begin experiment, and end experiment.
I need to replicate that code for 4 different loops that I have
Pleased to see you are making progress so far! I think this is still because you have the same trigger being sent in the each frame tab
port.write(b'1')
What happens if you set the code to be the same as that in the Begin Routine tab? (i.e. using the trigger variable)? Also, so you really want to be sending a trigger on every frame? or just at the onset of a stimulus/event?
Hi Becca,
So if I write
port.write(trigger)
in the begin rutine and in each frame tab, it doesn’t mark anything. it doesn’t even send the triggers. But when I had port.write(b’1’)
I was getting something like this
I have tried adding something like
port.write(b’1’)
port.write(b’2’)
but it gets messier.
so because I’m measuring RT, I need to see how long it takes the participant to answer that stimulus, so that means that the trigger needs to appear when the stimulus is shown and disappear when the participant press the response key.
Hi Becca,
So my guess about what’s going wrong is that either it’s sending too many triggers, I only need 2 or it’s sending them at the right time but leaving the port open too long. I need the port to be open just for 2 seconds. So because this is an experiment for kids, I have the stimuli presented for 3 seconds, but I need the port to be open for 2 seconds or until the participant answers (during those 2 seconds that the port will be open)
So I have the same for each “loop”. I recorded data and it shows 49 for words in English, including nonwords (when I put the triggers format as a decimal in actiview and 204 Spanish words. But, it didn’t record all of the stimuli, I only had 45 out 80 recorded, meaning that when some words are presented, triggers do not appear, and if doesn’t matter if it’s a word in English or Spanish or NonWord.
Now the triggers do not appear as a messy chunk in ActiView, but as a “line”
Also, In my trigger list, I have out different triggers for each category, so for English words (ENG in my type list in excel) I have 1, for Spanish words (SP) I have 2 and for Non Words (NW) i have 3
But to make it simple, i can just have Words and NonWords. Im happy with that.
triggers are synched to the stimulus presented. As soon as the stimulus appears, the trigger appears and as soon as the correct key is press, it disappears. Also, it stays for the same amount of time as the stim, so 3 seconds. I need this to be 2 seconds
Could you possibly share the .psyexp file as it is now and I’ll take a look
Also for thie Now the triggers do not appear as a messy chunk in ActiView, but as a “line” to clarify you want a single “line” at the start of each stimulus rather than a messy chunk? I suspect the messy chunk is from sending a trigger on each frame?
I recorded data and it shows 49 for words in English, including nonwords (when I put the triggers format as a decimal in actiview and 204 Spanish words. But, it didn’t record all of the stimuli, I only had 45 out 80 recorded, meaning that when some words are presented, triggers do not appear, and it doesn’t matter if it’s a word in English or Spanish or NonWord.