Using trigger to discriminate stimuli

What are you trying to achieve?:
I have three types of stimuli in my experiment: neg_vis, neg_rea and neu. They are presented in a randomized order. I want to configure a parallel port so that i know when each type of stimuli was presented.

What did you try to make it work?:

So i wrote some lines of code to create a list called “trigger”, in such a manner that neg_vis corresponds to 31, neg_rea to 32 and neu to 33:

(In the “begin experiment tab”):

#Define lists of images and shuffle:
instruction =
useRows =
trigger =

trialTypes = [1,1,1,2,2,2,3,3,3]

neutral = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29]
shuffle(neutral)
negative = [30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89]
shuffle(negative)

#Distribute images and instructions for each trial, separating in blocks:
for Idx in range(10):
shuffle(trialTypes)
for Jdx in range(9):
if trialTypes[Jdx] == 1:
instruction.append(‘Visualizar’)
useRows.append(negative.pop())
trigger.append(31)
elif trialTypes[Jdx] == 2:
instruction.append(‘Reavaliar’)
useRows.append(negative.pop())
trigger.append(32)
else:
instruction.append(‘Visualizar’)
useRows.append(neutral.pop())
trigger.append(33)

I then added a parallel port component. I set the start of the parallel port to be “$image.status == STARTED” and the duration to be 0.1s. And in the data tab of this component i set the start data to be “trigger[trials.thisN]”.

What specifically went wrong when you tried that?:
The parallel port is not sending the triggers. The data sheet shows only the time in which the image started. Of course, if i add “thisExp.addData(‘trigger’,trigger[trials.thisN])” and get the triggers in the datasheet. However, i will not be able to see it in other softwares, like Nirstar, if i don’t use a parallel out to send the trigger numbers 31, 32 and 33.

HOW DO I VISUALIZE THE TRIGGERS 31, 32 AND 33 THROUGH A PARALLEL PORT?

If you are using Builder, and you have a column called “trigger” in the spreadsheet you provide to your loop (e.g. the file that is providing the values “valence”), you should be able to use this value directly in the parallel port component like this: