portReceiver

 elements

Waits to receive data at a serial port, then registers a trigger and ends on its own (so you don't need to set property end unless you want it to end earlier). You can set elements in the trial to start/end from trigger (element properties start/end fields trigger/triggerBy). You can also set later trials to start at fixed times from trigger (trial object property start).

Trigger value recorded in record property trigger is a row vector of bytes (integers 0–255) received. Trigger time recorded in triggerTime is time receive completed relative to trial 1 start.

If you want to set options for the port, you can use pb_prefs → "Other" tab. Or to set for only the current experiment, make an object of type port and set its properties. Typically you don't need to.

Currently portReceiver elements only work with serial ports.

For each trial you define in an experiment script, you can make one or more 

portReceiver

 objects using 

portReceiver

Object and input them to addTrial.

For each trial you define in an experiment script, you can make one or more 

portReceiver

 objects using 

portReceiver

Object and input them to addTrial.

Input properties

Adjustable properties

You can allow the subject to adjust the following input properties of an object of this type during the experiment using an adjuster element. If you need to make other properties adjustable, you can copy the element type using newPbType and edit it.

position
nn_eyes
rotation
opacity

(None)

(None)

portName

No default

A string that is name of the serial port, as accepted by Psychtoolbox IOPort('OpenSerialPort'). From Psychtoolbox documentation: On Windows this could be, e.g. <cds>"COM1"<cds>, <cds>"COM2"<cds>, etc.; on Mac it is a path to a BSD device file, e.g. <cds>"/dev/cu.usbserial-FT3Z95V5"<cds> for a serial-over-USB device with unique ID FT3Z95V5; on Linux e.g. <cds>"/dev/ttyS0"<cds> for the first real serial port, <cds>"/dev/ttyUSB0"<cds> for the first serial-over-USB device, etc.

numBytes
listenData

Default: wait for any signal of 1 byte

Set one of these properties to specify what the element waits for to register a trigger and end on its own:

numBytes is number of bytes of any value to receive.

You can set numBytes = <cd>inf<cd> to receive data indefinitely until the element ends on a cue you set in property end. In this case it never registers a trigger. Currently this only reads data indefinitely within the trial the element runs in. Functionality to read data continuously across trials is coming soon.

OR

listenData is a row vector of byte values (integers 0–255) to listen for. You can specify multiple signals using a cell array of row vectors—the element will then listen for ANY of them.

Input properties all visual elements have

position

Input properties all adjuster elements have

adjust

Input properties all objects have

report
info

Record properties

PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results using input property report.

data
dataTimes

data is a row vector of bytes received. Just = record property trigger if the element registers a trigger.

dataTimes is a row vector of times bytes were received relative to trial 1 start (sec). As opposed to triggerTime, which is time the last byte was received.