The button is the 0-based button number (i.e. Sets the state (0 or 1) of the specified button (0 - 31). Stops the game controller emulation to a connected computer.
#Arduino 1.8.5 comment section expand update
If initAutoSendState is set to false, the ndState method must be called to update the game controller state. By default all methods update the game controller state immediately. Starts emulating a game controller connected to a computer. The simpler library that is used for the Joystick2 and Joystick3 libraries is documented at the end of this posting. The following describes the complete Joystick library. Now that the Joystick library is available to the Arduino IDE, an Arduino Leonardo or Arduino Micro can be used for custom game controller projects. The test script will test the game controller functionality in the following order: While this dialog has focus, ground pin A0 on the Arduino to activate the test script. Select the Arduino Leonardo or Micro and click the Properties button to display the game controller test dialog. The Arduino Leonardo or Micro should appear in the list of installed game controllers. Select “Game controller settings” to get to the “Game Controllers” dialog. Next right mouse click on the Arduino Leonardo or Arduino Micro to display the settings menu.
The Arduino Leonardo or Arduino Micro should appear in the list of devices.
#Arduino 1.8.5 comment section expand windows
Go to the Windows Control Panel and select “Hardware and Sound”. If you have a different version of Windows or a different operating system, these steps may differ. This sketch should be loaded, compiled, and uploaded to the Arduino Leonardo or Micro using the Arduino IDE (version 1.6.6 or above). Included in the library is a test sketch, called UsbJoystickTest.ino (or UsbJoystick2Test.ino or UsbJoystick3Test.ino).
The library (or libraries) should now appear in the Arduino IDE list of libraries.