Coming soon – the EyeLink 3. Combined head and eye tracking at up to 1000 Hz.

Template: Button Responses from Parallel Port Button Boxes
#1
Button Responses from Parallel Port Button Boxes - Non-Eye Tracking Example

Required Experiment Builder Version: 1.10.1241 or higher
EyeLink Required: No
Type: Complete Example
Difficulty Level: Easy to intermediate

This example illustrates:
  • How to use TTL trigger to get button events via Parallel port (SimpleBehavioralButtonBox.ebz)
  • How to use Custom Class node to grab button events via Parallel (Parallel_Port_Non_Eye_Tracking_Button_Box.ebz and TTL_Monitor_EB.ebz)
Description:

Note: There are three projects here, illustrating how to use a parallel port button box, e.g., VPixx's ResponsePixx series, SR Research Gamepad (a modified Gravis Destroyer gamepad), with non-eye tracking experiments in Experiment Builder. For these types of experiments the button box would need to be connected to the parallel port of the Display PC (there is no Host PC in a non-eye tracking experiment).

For eye-tracking experiments you would not need to use the methods described here. Instead you would connect the button box to the Host PC and just use the EL_BUTTON trigger. Please see this example illustrating how to collect responses for eye-tracking experiments.


SimpleBehavioralButtonBox.ebz: uses TTL trigger to accept the button input. The tricky part is that you have to use a different TTL trigger for each button. So, if you want to accept input from all five buttons then you need to have five TTL triggers in parallel. You will see this type of thing in the innermost sequence of the project. Each TTL trigger needs to have a different pin configuration so that it fires for just one particular button. I used the third project to determine the pin configuration.

Parallel_Port_Non_Eye_Tracking_Button_Box.ebz: uses one TTL trigger for all five buttons and then uses Custom Class to get the button value. I set the project up so that each trial has a loop that allows you to press the button box buttons as many times as you want. The TEXT_RESOURCE in the DISPLAY_SCREEN action in the TRIAL_EVENT sequence displays the value of the button that is currently being pressed (so you can see it is working). The trial ends with a keyboard press.

If you want to add this functionality to your projects you can do the following:
  1. Enable Custom Class (Edit -> Preferences -> Experiment -> Enable Custom Class).
  2. Add the GetButtonResponseValue custom class I wrote (you can find it in the /library/customClass/ folder of the project I am sending you) in the Library Manager under the Custom Class section.
  3. Add a CUSTOM_CLASS_INSTANCE node (this is in the Other section of the nodes). For its Custom Class property choose the GetButtonResponseValue Class.
  4. Use a TTL_INPUT trigger in place of your EL_BUTTON trigger. Set Mode to Pin and make sure each pin is set to Either.
  5. Add an EXECUTE action after the TTL_INPUT trigger. Make a reference to the getButtonValue method of the Custom Class Instance for the Execute Method property. Make a reference to the TTL_INPUT triggeredData -> pinData for the pinValues property.
  6. Use an UPDATE_ATTRIBUTE action to set the value of a variable to the value that is returned by the EXECUTE action.
TTL_Monitor_EB.ebz (Windows Only): was just used to figure out the pin values corresponding to each of the buttons. When you run the project it will present some graphics that show what is currently happening with your parallel port. The button presses will be received on the Status Register. The "Status" value that fires as a result of a button press corresponds to the Pin value in the TTL trigger in Experiment Builder -- you must set the Mode of the TTL trigger to Pin (instead of to Word) to see the different Pin values . For example, when you press button 1 you will see that Status 5 changes from red to not red. This means that Pin 5 is going from On to Off (red is on, not red is off). This means that if you want the TTL trigger to only fire for button 1, then you can first set the Mode of your TTL trigger to Pin, then set Pin 5 to Off and all the other Pins to Either.
  • When you press Button 1, Pin 5 goes from On to Off (meaning it fires for an Off value)
  • When you press Button 2, Pin 6 goes from On to Off (meaning it fires for an Off value)
  • When you press Button 3, Pin 3 goes from On to Off (meaning it fires for an Off value)
  • When you press Button 4, Pin 4 goes from On to Off (meaning it fires for an Off value)
  • When you press Button 5, Pin 7 goes from Off to On (meaning it fires for an On value)
The button values for the VPixx boxes are Yellow = 1, Red = 2, Blue = 3, Green = 4, White = 5. The button values for the SR Researcj Gamepag (the Gravis Destoyer gamepad) are Blue = 1, Green = 2, Yellow = 3, Red = 4, and Purple (d-pad) = 5. The trigger buttons on the SR Research Gamepad do not work (this is because the Status register of the parallel port, which is used to receive the TTL pulses from the button boxes, only has five pins on it).

Instructions:
  1. Download the relevant EBZ example file from this message.
  2. Launch the Experiment Builder application.
  3. Unpack the EBZ file to a location on your Experiment Builder PC with "File menu -> Unpack".
  4. Open the project in Experiment Builder.
  5. Deploy the project to a new folder.
  6. Run the EXE project file from the deployed directory.



.ebz   Parallel_Port_Non_Eye_Tracking_Button_Box.ebz (Size: 61.44 KB / Downloads: 16)

.ebz   SimpleBehavioralButtonBox.ebz (Size: 59.12 KB / Downloads: 20)

.ebz   TTL_Monitor_EB.ebz (Size: 51.08 KB / Downloads: 12)