09-09-2020, 09:37 AM
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:
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:
Instructions:
Parallel_Port_Non_Eye_Tracking_Button_Box.ebz (Size: 61.44 KB / Downloads: 16)
SimpleBehavioralButtonBox.ebz (Size: 59.12 KB / Downloads: 20)
TTL_Monitor_EB.ebz (Size: 51.08 KB / Downloads: 12)
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)
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:
- Enable Custom Class (Edit -> Preferences -> Experiment -> Enable Custom Class).
- 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.
- Add a CUSTOM_CLASS_INSTANCE node (this is in the Other section of the nodes). For its Custom Class property choose the GetButtonResponseValue Class.
- 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.
- 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.
- Use an UPDATE_ATTRIBUTE action to set the value of a variable to the value that is returned by the EXECUTE action.
- 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)
Instructions:
- Download the relevant EBZ example file from this message.
- Launch the Experiment Builder application.
- Unpack the EBZ file to a location on your Experiment Builder PC with "File menu -> Unpack".
- Open the project in Experiment Builder.
- Deploy the project to a new folder.
- Run the EXE project file from the deployed directory.
Parallel_Port_Non_Eye_Tracking_Button_Box.ebz (Size: 61.44 KB / Downloads: 16)
SimpleBehavioralButtonBox.ebz (Size: 59.12 KB / Downloads: 20)
TTL_Monitor_EB.ebz (Size: 51.08 KB / Downloads: 12)