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
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
-
### ALPHA Testing: This branch is currently in development. All functions have been implemented, but not optimized at this time. Feel free to try it out and let me know if you have any issues. The examples are not 100% up-to-date yet.
1
+
### BETA Testing: This branch is currently being tested. All functions have been implemented and optimized. Feel free to try it out and let me know if you have any issues. The examples are not 100% up-to-date yet.
2
2
3
3
# Arduino Joystick Library
4
-
#### Version 2.0.0 (in Alpha Testing)
4
+
#### Version 2.0.0 (in Beta Testing)
5
5
This library can be used with Arduino IDE 1.6.6 (or above) to add one or more joysticks (or gamepads) to the list of HID devices an Arduino Leonardo or Arduino Micro (or any Arduino clone that is based on the ATmega32u4) can support. This will not work with Arduino IDE 1.6.5 (or below).
6
6
7
7
##Installation Instructions
8
-
Copy the Joystick folder to the Arduino libraries folder (typically %userprofile%\Documents\Arduino\libraries). The library should now appear in the Arduino IDE list of libraries. The examples should also appear in the examples menu.
8
+
Copy the Joystick folder to the Arduino libraries folder (typically `%userprofile%\Documents\Arduino\libraries`). On Microsoft Windows machines, the `deploy.bat` file can be executed to install the Joystick folder (assuming a default Arduino installation). The library should now appear in the Arduino IDE list of libraries. The examples should also appear in the examples menu in the Arduino IDE.
9
9
10
10
##Examples
11
11
The following example Arduino sketch files are included in this library:
@@ -22,19 +22,20 @@ The following example Arduino sketch files are included in this library:
22
22
23
23
#include <Joystick.h>
24
24
25
+
// Create the Joystick
25
26
Joystick_ Joystick;
26
27
28
+
// Constant that maps the phyical pin to the joystick button.
29
+
const int pinToButtonMap = 9;
30
+
27
31
void setup() {
28
32
// Initialize Button Pins
29
-
pinMode(9, INPUT_PULLUP);
33
+
pinMode(pinToButtonMap, INPUT_PULLUP);
30
34
31
35
// Initialize Joystick Library
32
36
Joystick.begin();
33
37
}
34
38
35
-
// Constant that maps the phyical pin to the joystick button.
36
-
const int pinToButtonMap = 9;
37
-
38
39
// Last state of the button
39
40
int lastButtonState = 0;
40
41
@@ -151,19 +152,19 @@ Sets the range of values that will be used for the Steering. Default: `0` to `10
151
152
Sets the Steering value. See `setSteeringRange` for the range.
152
153
153
154
###Joystick.setButton(byte button, byte value)
154
-
Sets the state (`0` or `1`) of the specified button (range: `0` - (`buttonCount - 1`)). 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.
155
+
Sets the state (`0` or `1`) of the specified button (range: `0` - (`buttonCount - 1`)). 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.
155
156
156
157
###Joystick.pressButton(byte button)
157
-
Press the indicated button (range: `0` - (`buttonCount - 1`)). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.).
158
+
Press the indicated button (range: `0` - (`buttonCount - 1`)). The button is the 0-based button number (i.e. button #1 is `0`, button #2 is `1`, etc.).
158
159
159
160
###Joystick.releaseButton(byte button)
160
-
Release the indicated button (range: `0` - (`buttonCount - 1`)). The button is the 0-based button number (i.e. button #1 is 0, button #2 is 1, etc.).
161
+
Release the indicated button (range: `0` - (`buttonCount - 1`)). The button is the 0-based button number (i.e. button #1 is `0`, button #2 is `1`, etc.).
161
162
162
163
###Joystick.setHatSwitch(byte hatSwitch, int value)
163
-
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.
164
+
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.
164
165
165
166
###Joystick.sendState()
166
-
Sends the updated joystick state to the host computer. Only needs to be called if `AutoSendState` is false (see `Joystick.begin` for more details).
167
+
Sends the updated joystick state to the host computer. Only needs to be called if `AutoSendState` is `false` (see `Joystick.begin` for more details).
167
168
168
169
##Testing Details
169
170
I have used this library to make an Arduino appear as the following:
@@ -193,4 +194,4 @@ Others have tested this library with the following boards:
0 commit comments