You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,88 +5,88 @@ Arduino IDE 1.6.6 (or above) library that adds a joystick to the list of HID dev
5
5
6
6
The lastest version of this library can be found at [https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/version-2.0](https://github.com/MHeironimus/ArduinoJoystickLibrary/tree/version-2.0).
7
7
8
-
##Support for one, two, or three joysticks
8
+
##Support for one, two, or three joysticks
9
9
This library comes in three flavors:
10
10
- Joystick - adds a single joystick that contains an X, Y, and Z axis (including rotation), 32 buttons, 2 hat switches, a throttle, and a rudder.
11
11
- Joystick2 - adds two simple joysticks that contain an X and Y axis and 16 buttons.
12
12
- Joystick3 - adds three simple joysticks that contain an X and Y axis and 16 buttons.
13
13
14
-
##Installation Instructions
14
+
##Installation Instructions
15
15
Copy one or more of the folders (Joystick, Joystick2, and Joystick3) to the Arduino libraries folder (typically %userprofile%\Documents\Arduino\libraries). The library (or libraries) should now appear in the Arduino IDE list of libraries.
16
16
17
-
##Joystick Library API
17
+
##Joystick Library API
18
18
The following API is available if the Joystick library in included in a sketch file.
19
19
20
-
###Joystick.begin(bool initAutoSendState)
20
+
###Joystick.begin(bool initAutoSendState)
21
21
Starts emulating a game controller connected to a computer. By default all methods update the game controller state immediately. If initAutoSendState is set to false, the Joystick.sendState method must be called to update the game controller state.
22
22
23
-
###Joystick.end()
23
+
###Joystick.end()
24
24
Stops the game controller emulation to a connected computer.
25
25
26
-
###Joystick.setXAxis(byte value)
26
+
###Joystick.setXAxis(byte value)
27
27
Sets the X axis value. Range -127 to 127 (0 is center).
28
28
29
-
###Joystick.setYAxis(byte value)
29
+
###Joystick.setYAxis(byte value)
30
30
Sets the Y axis value. Range -127 to 127 (0 is center).
31
31
32
-
###Joystick.setZAxis(byte value)
32
+
###Joystick.setZAxis(byte value)
33
33
Sets the Z axis value. Range -127 to 127 (0 is center).
34
34
35
-
###Joystick.setXAxisRotation(int value)
35
+
###Joystick.setXAxisRotation(int value)
36
36
Sets the X axis rotation value. Range 0° to 360°.
37
37
38
-
###Joystick.setYAxisRotation(int value)
38
+
###Joystick.setYAxisRotation(int value)
39
39
Sets the Y axis rotation value. Range 0° to 360°.
40
40
41
-
###Joystick.setZAxisRotation(int value)
41
+
###Joystick.setZAxisRotation(int value)
42
42
Sets the Z axis rotation value. Range 0° to 360°.
43
43
44
-
###Joystick.setButton(byte button, byte value)
44
+
###Joystick.setButton(byte button, byte value)
45
45
Sets the state (0 or 1) of the specified button (0 - 31). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.). The value is 1 if the button is pressed and 0 if the button is released.
46
46
47
-
###Joystick.pressButton(byte button)
47
+
###Joystick.pressButton(byte button)
48
48
Press the indicated button (0 - 31). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.).
49
49
50
-
###Joystick.releaseButton(byte button)
50
+
###Joystick.releaseButton(byte button)
51
51
Release the indicated button (0 - 31). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.).
52
52
53
-
###Joystick.setThrottle(byte value)
53
+
###Joystick.setThrottle(byte value)
54
54
Sets the throttle value. Range 0 to 255.
55
55
56
-
###Joystick.setRudder(byte value)
56
+
###Joystick.setRudder(byte value)
57
57
Sets the rudder value. Range 0 to 255.
58
58
59
-
###Joystick.setHatSwitch(byte hatSwitch, int value)
59
+
###Joystick.setHatSwitch(byte hatSwitch, int value)
60
60
Sets the value of the specified hat switch. The hatSwitch is 0-based (i.e. hat switch #1 is 0 and hat switch #2 is 1). The value is from 0° to 360°, but in 45° increments. Any value less than 45° will be rounded down (i.e. 44° is rounded down to 0°, 89° is rounded down to 45°, etc.). Set the value to -1 to release the hat switch.
61
61
62
-
###Joystick.sendState()
62
+
###Joystick.sendState()
63
63
Sends the updated joystick state to the host computer. Only needs to be called if AutoSendState is false (see Joystick.begin for more details).
64
64
65
-
##Joystick2 and Joystick3 Library API
65
+
##Joystick2 and Joystick3 Library API
66
66
The following API is available if the Joystick2 or Joystick3 library in included in a sketch file.
67
67
68
68
The joystickIndex is 0-based (i.e. the first game controller has a joystickIndex of 0, the second has a joystickIndex of 1, and the third has a joystickIndex of 2).
Starts emulating a game controller connected to a computer. By default all methods update the game controller state immediately. If initAutoSendState is set to false, the Joystick[joystickIndex].sendState method must be called to update the game controller state.
72
72
73
-
###Joystick[joystickIndex].end()
73
+
###Joystick[joystickIndex].end()
74
74
Stops the game controller emulation to a connected computer.
75
75
76
-
###Joystick[joystickIndex].setXAxis(byte value)
76
+
###Joystick[joystickIndex].setXAxis(byte value)
77
77
Sets the X axis value. Range -127 to 127 (0 is center).
78
78
79
-
###Joystick[joystickIndex].setYAxis(byte value)
79
+
###Joystick[joystickIndex].setYAxis(byte value)
80
80
Sets the Y axis value. Range -127 to 127 (0 is center).
Sets the state (0 or 1) of the specified button (0 - 15). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.). The value is 1 if the button is pressed and 0 if the button is released.
Release the indicated button (0 - 15). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.).
90
90
91
-
###Joystick[joystickIndex].sendState()
91
+
###Joystick[joystickIndex].sendState()
92
92
Sends the updated joystick state to the host computer. Only needs to be called if AutoSendState is false (see Joystick[joystickIndex].begin for more details).
0 commit comments