SR Box
Overview
- About the srbox plug-in
- Screenshot
- Setting the device name
- Requirements
- Download and installation
- Using the SR Box from Python inline code
About the srbox plug-in
The serial response (SR) box is a button box, specifically designed for response collection in psychological experiments. The original version, developed by Psychology Software Tools, has 5 buttons, 5 lights, and is connected to the PC trough the serial port. There are also SR Box compatible devices by other manufacturers, which may differ in the number of buttons and lights and often use a USB connection, which emulates a serial port. The advantage of using an SR Box is that response times can be measured more accurately than using a garden variety keyboard. Of course, it also looks much more sciency. The SR Box plug-in for OpenSesame allows you to use the SR Box or compatible device in your OpenSesame experiments. The plug-in appears as an item in the item toolbar and you can simply drag it into your experiment.
Screenshot
Setting the device name
By default, the plug-in tries to autodetect your SR Box. If this works, you don’t have to change it. If your experiment freezes, OpenSesame has chosen the wrong serial port and you must enter the device name manually. Under Windows, the device is probably called something like
COM4
Under Linux the device is probably called something like
/dev/tty0
Requirements
An SR Box or compatible device and OpenSesame 0.22 or higher.
Download and installation
As of 0.25, the srbox plugin is included with OpenSesame by default, so no installation is required.
Using the SR Box from Python inline code
If you insert the srbox plugin at the start of your experiment, an srbox
object automatically becomes part of the experiment object and can be accessed from within an inline_script item as exp.srbox
. Below is a list of available functions.
Function overview:
__init__
close
get_button_press
send
start
stop
Arguments:
experiment → Opensesame experiment.
Keywords arguments:
dev → The srbox device port or None for auto-detect (default=None).
Keywords arguments:
allowed_buttons → A list of buttons that are accepted or None to accept all buttons. Valid buttons are integers 1 through 8. (default=None)
timeout → A timeout value or None for no timeout. (default=None)
Returns:
A timestamp, buttonlist tuple. The buttonlist consists of a list of button numbers.
Example:
exp.srbox.start()
timestamp, buttonlist = exp.srbox.get_button_press(allowed_buttons=[1,2])
if 1 in buttonlist:
print('Button 1 was pressed!')
exp.srbox.stop()
Arguments:
ch → The character to send.
Example:
exp.srbox.start()
timestamp, buttonlist = exp.srbox.get_button_press(allowed_buttons=[1,2])
if 1 in buttonlist:
print('Button 1 was pressed!')
exp.srbox.stop()
Example:
exp.srbox.start()
timestamp, buttonlist = exp.srbox.get_button_press(allowed_buttons=[1,2])
if 1 in buttonlist:
print('Button 1 was pressed!')
exp.srbox.stop()