Millisecond Forums

Port triggered from Random displayed images

https://forums.millisecond.com/Topic10644.aspx

By Lostcode - 6/11/2013

I have a couple different images set up in an item list named trigg. I have a trial that will display the picture for a certain duration. The block will add one to the current target list so it will cylce through until done.



What I am trying to do is get it so that the 10 specific images in the 30 will trigger a port when displayed. There are 2 images for each port because they send a different data output.



Is there any way to get this to work. Like an if statement/ condition in the Block?

By Dave - 6/11/2013

Since <port> elements are essentially equivalent to all other stimulus elements such as <text> or <picture>, the "How to present stimulus pairs" topic in the documentation should answer your question.

By Lostcode - 6/11/2013

So if I were to do a
/ select = picture.trigg

What would be required for the first image?

By Dave - 6/11/2013

So if I were to do a
/ select = picture.trigg

What would be required for the first image?


Unfortunately this example is meaningless without context. In general: Your <picture> elements comprise a number of /items. So do your <port> elements. You'll want to have the "item" (i.e. TTL signal) in the <port> depend on the item of the <picture>. Exactly that you'll find covered in the documentation topic I mentioned, only with <text> elements.

By Lostcode - 6/11/2013

<item trigg>


there are 10 pics here


/1 = "Img/muffins.jpg" <-- example


</item>



<picture trigg>


/ items = trigg


</picture>



<port ptrigg>


/ port = lpt1


/ subport = data


/ items = ("00000001")


/ select = ?????


</port>




What needs to be where?

By Dave - 6/11/2013

(1) If the TTL signal is *always the same* as in your example, there is no need for any selection stuff at all. Simply have your <trial> "display" it along with the picture.


(2) Have you given http://www.millisecond.com/support/docs/v4/html/howto/howtopairs.htm a look? If so, it should be clear how to define the dependency between elements.

By Lostcode - 6/11/2013

The TTL signals will be different for groupings of 2 images in the 10 items.


The trial I have does:

<trial trigg>
/ stimulustimes = [0=trigg]
/ trialduration = 1700
/ validresponse = ("W")
/ correctresponse = ("W")
</trial>


So I would need to associate multiple <port> Since there would be 5 other ports sending different data.

By Dave - 6/11/2013

So I would need to associate multiple <port> Since there would be 5 other ports sending different data.


No. A <port> can have multiple /items just like a <text> or <picture>.

By Lostcode - 6/11/2013

I will be associating different <port> items with different pictures.


My trial pulls from the pictures listed in <picture trigg> which is from a <item trigg> list.



The block takes that info and randomizes the pictures being displayed.

How would I go about making the picture that is displayed send the item in <port>?

By Dave - 6/11/2013

Suppose I have a <text> element with two items, A and B. I want to sent a <port> signal, 00000001 for A and 00000010 for B:

<trial mytrial>
/ stimulusframes = [1=mytext, myport]
[...]
</trial>

<text mytext>
/ items = ("A", "B")
/ select = noreplace
</text>

<port myport>
/ items = ("00000001", "00000010")
/ select = text.mytext.currentindex
</port>


The same applies when using a <picture> instead of <text>.

By Lostcode - 6/12/2013

That worked thank you.

Last questions:


Is there a way to set it up so that when a valid response is triggered the port will spit out a response?

By Dave - 6/12/2013

See http://www.millisecond.com/forums/Topic1721.aspx.

By Lostcode - 6/17/2013

Is there a way to set a pulse width in inquisit for the TTL port? Like I want it to display the number then end with a zero for the pulse after so many ms.

By Dave - 6/17/2013

Well, yes. Simply send another <port> with 00000000 at the desired time after the signal via the <trial>'s /stimulustimes:


http://www.millisecond.com/forums/Topic5755.aspx#5755

By Lostcode - 6/17/2013

Reference to older question.


I have 2 items in stimulustime for a trial
the port is triggered when spacebar is pressed. It is only displaying for the second item being displayed.


Is there something I need to reference so it is recorded both times?

By Dave - 6/17/2013

I have 2 items in stimulustime for a trial
the port is triggered when spacebar is pressed. It is only displaying for the second item being displayed.


I fail to understand what exactly the above is supposed to mean. Please be more specific, i.e., provide a clearer description (what is / isn't sent; what's the desired vs. the observed behavior) as well as a concrete, minimal example w/ code.


In case you are referring to signals sent via /responsemessage or the like, no, there is no way to record those.

By Lostcode - 6/17/2013

<trial test>
/ stimulustimes = [0=test1, test1Port; 200=test2, test2Por]
/ validresponse = (" ")
/ correctresponse = (" ")
/ responsemessage = (" ", broadPort, 50)
</trial>


When spacebar is hit during test1 nothing is broadcast. When hit during test2 it broadcasts the corresponding responsemessage port.

By Dave - 6/17/2013

When spacebar is hit during test1 nothing is broadcast.


Please see the documentation for the /responsetime attribute. The above is the default, expected behavior.


When hit during test2 it broadcasts the corresponding responsemessage port.


That is expected, too. In addition, please see the documentation for the /responseinterrupt attribute.