Welcome Guest, you are in: Login

EventIDE Wiki

RSSRSS

Navigation




Search the wiki


PoweredBy

Page History: HID Input Element

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: 2015/01/16 12:40




Element Icon HID Input element
Info
Category: Behaviour Control AddIn: Base Elements
Creator: OkazoLab Team Scope: Parent Event
Owns Snippets: no Usage: Input, Snippets

Actions aligned with epochs of the parent event

EpochActions
After OnsetThe element starts monitoring buttons and axis
Control Loop stepTriggered snippet is invoked, if the button (not axis!) state changes according to the selected triggering mode.
Before OffsetThe element stops monitoring buttons and axis

Properties

Generic properties

NameDescriptionConstraintsValue TypeUpon Change
Control
Input deviceDefines the monitored HID device.enum
Monitored ButtonDefines a button monitored by the element. If 'Any Button' selected, the element monitors all buttons on the selected input device. In this case, a name of the pressed button is returned by the Triggering Button property at runtime.String
Triggering ModeDefines the triggering mode for button. The First Press Only mode is recommended for response time measurements. enum
Device Info
Button NumberReturns the total number of buttons on the selected HID deviceInt32
Axis NumberReturns the total number of analog axis on the selected HID deviceInt32
Axes ScalingDefines whether the axis values are automatically scaled into device's logical range. If false, the physical axis values are returned.Boolaen
Runtime status
Triggering TimeReturns a local event time (in ms) of the last button triggering. The value can be used an accurate measure of the response timeclTime
Is TriggeredIndicates whether a button has been triggered at least once since the onset of the parent event. The property resets on each onset of the parent event. This property can be naturally used to gate switching between events. Boolean
Triggered ButtonReturns a name of the triggered button (pressed or released depending on the Triggering Mode). The keyboard symbol buttons are indicated by capital letters, whereas mouse and gamepad buttons have names like 'Button 1' and so on. String
Is DownIndicates whether the monitored button is currently in the down stateBoolean

+=== Properties inherited from clElement === Inherited properties of clElement
NameDescriptionConstraintsValue TypeUpon Change
Control
Is EnabledIf set to false the element is completely omitted when the experiment is run.Boolean
TitleTitle of the element.String



HID Input element detects button presses/releases on HID (Human Interface Devices) and monitors changes in device's analog axis. The HID devices include the keyboards, mouses, joysticks, gamepad and some response boxes. If you need to record keys on primary input devices, e.g. on the system mouse, use the Button element for slightly better timing. The HID Input element collects accurate timing statistics of key presses and releases and changes in analog axis, hence, it can be used for recording reaction time of participant responses. Multiple HID Input elements can be used to record for one or several input devices in parallel. The HID Input element monitors an input device only within a scope of it's parent event and return local timing statistics, e.g. a press time as the number of milliseconds since the onset of the parent event.


Selection of the monitored button

The HID Input element can monitor either one specific button, or all buttons in the same time (when 'Any Button' is selected in the Monitored Button property). In many experimental tasks, e.g.2AFC, there are two response buttons for a participant. Given flexibility of the HID Input element, for the 2ADC tasks you can use different design patterns:

  1. Create two button elements, each monitoring one of the predefined response buttons
  2. Create one button element monitoring 'Any' button and write a code that checks, what button is pressed. The name of the pressed button is returned by the Triggered Button property

The first pattern allows to automatically ignore presses of irrelevant buttons. The second pattern is more convenient for collecting a reaction time in trial, because you can get from a single proxy variable link to the Triggering Time property of the button element.

Triggering modes for buttons

When monitoring buttons, the HID Input element is not limited to registering just button presses. There are 5 'triggering' modes for buttons, in which the HID Input element can operate. You need to select the triggering mode in advance, according to your requirements:

  • First Press Only
  • First Release Only
  • Multiple Presses
  • Multiple Releases
  • Holding Down

Depending on the working mode, the element becomes 'triggered' when a specific input pattern is detected. The First Press Only mode is the default choice for registering the fastest reaction time, because in this mode the element ignores all successive presses. Other modes are self-explanatory, save for the holding down mode, which detects continuously presses, common in the game-like activities.

HID Button Names

The HID Input element uses the button naming defined by an HID device. For example, the keyboard number buttons in the horizontal row are denoted as 'D1','D2'..'D0'. Other HID devices name their buttons as: 'Button 1', 'Button 2' and so on. Be aware that you need to maintain capital letter in the button names, when operating with them in C# code. You can easily find out the actual button name, using the design-time press detector on the HID Input element. Open an editor for the Monitored Button property and move the mouse cursor over the picture with a web. Then, press the desired button and check its name in the top row:
Using the press detector  to set the monitored button  or find out the button name

Using the press detector
to set the monitored button
or find out the button name


Triggered Snippet

The HID Input element can invoke custom user code each time, when it becomes triggered (e.g. on a button press). To engage the triggering snippet, open it via the snippet panel and write your code there. Note that the triggered snippet is invoked only once, on the first press, when the 'First Press Only' triggering mode is selected. The triggered snippet can be used for checking a name of the pressed button:


if (TriggeringButton=="NumPad4")
    Positon.X=PositionX-1;
if (TriggeringButton=="NumPad6")
    Positon.X=PositionX+1;


ScrewTurn Wiki version 5.2.0.8. Some of the icons created by FamFamFam.