* Use the _DEVICEINPUT {{Parameter|device%}} [[INTEGER]] returned to find the number of the controller device being used.
* A literal specific {{Parameter|device_number%}} parameter can be used to return -1 if active or 0 if inactive. {{text|EX: '''WHILE _DEVICEINPUT(2)'''|green}}
{{PageDescription}}
* Use [[_DEVICES]] to find the number of controller devices available BEFORE using this function.
* [[_DEVICE$]] can be used to list the device names and control types using valid [[_DEVICES]] numbers.
* When a device button is pressed or a scroll wheel or axis is moved, the device number will be returned.
* Devices are numbered as 1 for keyboard and 2 for mouse. Other controller devices will be numbered 3 or higher if installed.
* [[_LASTBUTTON]], [[_LASTAXIS]], or [[_LASTWHEEL]] will indicate the number of functions available with the specified ''device'' number.
* User input events can be monitored reading valid numbered [[_AXIS]], [[_BUTTON]], [[_BUTTONCHANGE]] or [[_WHEEL]] functions.
* ''Note:'' [[ON...GOSUB|ON _DEVICEINPUT GOSUB]] keyboard, mouse, gamecontrol can be used to control the devices 1,2 and 3, etc.
{{PageExamples}}
''Example 1:'' Checking device controller interfaces and finding out what devices are being used.
{{CodeStart}}
{{Cl|FOR...NEXT|FOR}} i = 1 {{Cl|TO}} {{Cl|_DEVICES}}
: ''Explanation:'' Referencing the [[_MOUSEMOVEMENTX]] function hides the mouse and sets the mouse to a relative movement mode which can be read by [[_WHEEL]]. [[_DEVICEINPUT]](2) returns -1 (true) only when the mouse is moved, scrolled or clicked.
''Example 3:'' Using [[ON...GOSUB]] with the [[_DEVICEINPUT]] number to add keyboard, mouse and game controller event procedures.
{{CodeStart}}
n = {{Cl|_DEVICES}} 'required when reading devices
{{Cl|PRINT}} "Number of devices found ="; n
{{Cl|FOR...NEXT|FOR}} i = 1 TO n
PRINT i; _DEVICE$(i) ' 1 = keyboard, 2 = mouse, 3 = other controller, etc.
{{Cl|NEXT}}
{{Cl|PRINT}}
{{Cl|DO...LOOP|DO}}: device = {{Cl|_DEVICEINPUT}}
{{Cl|ON...GOSUB|ON device GOSUB}} keyboard, mouse, controller 'must be inside program loop