This is documentation for Mathematica 7, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

ControllerState

ControllerState["c"]
gives the state of the control c for the first connected controller device on which it is supported.
ControllerState[{"c1", "c2", ...}]
gives the states of several controls.
ControllerState[id, "c"]
gives the state of control c for controller devices with the specified identifier.
ControllerState[id, {"c1", "c2", ...}]
gives the states of several controls for several controller devices.
  • Dynamic[ControllerState[...]] gives continually updated current controller states.
  • Typical control names include:
"X" or "X1"xprimary x value
"Y" or "Y1"yprimary y value
"Z" or "Z1"zprimary z value
"XY" or "XY1"{x,y}primary 2-axis controller value
"XYZ" or "XYZ1"{x,y,z}primary 3-axis controller value
"X2", "Y2", "XY2", etc.x, y, {x, y}, etc.values from a secondary controller
"B1", "B2", etc.b1, b2, etc.button states
  • The following special control names are also possible:
"Axes"a list of all supported axis-like controls
"Buttons"a list of all supported button-like controls
"Controls"a list of all supported controls
"Hardware"information on the controller device hardware
"Mapping"rules for Mathematica mappings of controls
"Rules"rules for the settings of all controls
  • ControllerState always gives absolute instantaneous control states; it does not give relative or cyclic control states of the type available in Manipulate.
  • If no explicit controller identifier id is given, the controller used will be the first one found on the list specified by the option ControllerPath that supports all the controls "ci" requested.
  • Identifiers for controllers can be the following:
"name"device name from ControllerInformation
"class"device class specifier
nraw device index from ControllerInformation
Allall devices supporting the requested controls
  • Possible device class identifiers include:
"Gamepad"controller typically including two analog controls
"Joystick"controller typically including one primary analog control
"Detachable"controller not built into a computer
"BuiltIn"controller built into a computer
Check the state of button 1:
Check multiple values at once:
Check the state of button 1:
In[1]:=
Click for copyable input
Out[1]=
Check multiple values at once:
In[2]:=
Click for copyable input
Out[2]=
Acquire a list of all button controls supported by the device:
Specify which controller type should be used:
If no device of that type is attached, $Failed is returned:
If multiple controllers are attached, specify the order of control sampling:
By default, controls are sampled in the following order:
Manipulate controls are automatically linked to a controller:
Bind x to the X controller when your selection contains the output:
ControllerInformation can be used to find a device name:
New in 6