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
+32-15Lines changed: 32 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,27 @@
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.
1
+
### BETA Testing
2
+
This branch is currently being tested. All functions have been implemented and optimized.
3
+
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
4
3
5
# Arduino Joystick Library
4
6
#### Version 2.0.1 (in Beta Testing)
5
7
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](https://www.arduino.cc/en/Main/ArduinoBoardLeonardo) or [Arduino Micro](https://www.arduino.cc/en/Main/ArduinoBoardMicro) (or any Arduino clone that is based on the ATmega32u4) can support. This will not work with Arduino IDE 1.6.5 (or below) or with non-32u4 based Arduino devices (e.g. Arduino UNO, Arduino MEGA, etc.).
6
8
7
-
##Installation Instructions
9
+
## Features
10
+
The joystick or gamepad can have the following features:
11
+
- Buttons (default: 32)
12
+
- Up to 2 Hat Switches
13
+
- X, Y, and/or Z Axis (up to 16-bit precision)
14
+
- X, Y, and/or Z Axis Rotation (up to 16-bit precision)
15
+
- Rudder (up to 16-bit precision)
16
+
- Throttle (up to 16-bit precision)
17
+
- Accelerator (up to 16-bit precision)
18
+
- Brake (up to 16-bit precision)
19
+
- Steering (up to 16-bit precision)
20
+
21
+
## Installation Instructions
8
22
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
23
10
-
##Examples
24
+
##Examples
11
25
The following example Arduino sketch files are included in this library:
12
26
13
27
-`JoystickTest` - Simple test of the Joystick library. Exercises many of the Joystick library functions when pin A0 is grounded.
@@ -18,7 +32,7 @@ The following example Arduino sketch files are included in this library:
18
32
-`FlightControllerTest` - Creates a Flight Controller and tests 32 buttons, the X and Y axis, the Throttle, and the Rudder when pin A0 is grounded.
19
33
-`HatSwitchTest` - Creates a joystick with two hat switches. Grounding pins 4 - 11 cause the hat switches to change position.
20
34
21
-
###Simple example
35
+
###Simple example
22
36
23
37
#include <Joystick.h>
24
38
@@ -52,7 +66,7 @@ The following example Arduino sketch files are included in this library:
52
66
delay(50);
53
67
}
54
68
55
-
##Joystick Library API
69
+
##Joystick Library API
56
70
The following API is available if the Joystick library in included in a sketch file.
57
71
58
72
### Joystick\_(...)
@@ -155,31 +169,31 @@ Sets the range of values that will be used for the Steering. Default: `0` to `10
155
169
### Joystick.setSteering(byte value)
156
170
Sets the Steering value. See `setSteeringRange` for the range.
157
171
158
-
###Joystick.setButton(byte button, byte value)
172
+
###Joystick.setButton(byte button, byte value)
159
173
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.
160
174
161
-
###Joystick.pressButton(byte button)
175
+
###Joystick.pressButton(byte button)
162
176
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.).
163
177
164
-
###Joystick.releaseButton(byte button)
178
+
###Joystick.releaseButton(byte button)
165
179
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.).
166
180
167
-
###Joystick.setHatSwitch(byte hatSwitch, int value)
181
+
###Joystick.setHatSwitch(byte hatSwitch, int value)
168
182
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 `JOYSTICK_HATSWITCH_RELEASE` or `-1` to release the hat switch.
169
183
170
-
###Joystick.sendState()
184
+
###Joystick.sendState()
171
185
Sends the updated joystick state to the host computer. Only needs to be called if `AutoSendState` is `false` (see `Joystick.begin` for more details).
172
186
173
-
##Testing Details
187
+
##Testing Details
174
188
I have used this library to make an Arduino appear as the following:
175
189
176
190
- 1 joystick / gamepad
177
191
- 2 joysticks / gamepads
178
192
- 3 joysticks / gamepads
179
193
- 4 joysticks / gamepads
180
194
181
-
I have tested with 1 - 32 buttons. I have also tested this with 1 - 64 buttons.
182
-
The standard Microsoft Windows Game Controller Test dialog only supports 32 buttons.
195
+
I have tested with 1 - 32 buttons using the standard Microsoft Windows Game Controller Test dialog.
196
+
I have also tested this with 1 - 64 buttons.
183
197
To test a joystick with over 32 buttons, a third-party testing tool will need to be used (e.g. http://www.planetpointy.co.uk/joystick-test-application/).
184
198
185
199
I have tested with 0, 1, and 2 hat switches.
@@ -191,6 +205,8 @@ I have tested this library using the following Arduino IDE Versions:
191
205
- 1.6.8
192
206
- 1.6.9
193
207
- 1.6.10
208
+
- 1.6.11
209
+
- 1.6.12
194
210
195
211
I have tested this library with the following boards:
196
212
@@ -201,8 +217,9 @@ Others have tested this library with the following boards:
201
217
-[SparkFun Pro Micro](https://www.sparkfun.com/products/12640)
202
218
203
219
Other board notes:
204
-
-[Arduino Due](https://www.arduino.cc/en/Main/ArduinoBoardDue) - The old Arduino IDE 1.6.5 (and below) version of this library (see [Add USB Game Controller to Arduino Leonardo or Micro](http://mheironimus.blogspot.com/2015/03/add-usb-game-controller-to-arduino.html)) should work with the Arduino Due, and Version 1.x of the new Arduino Joystick Library will work with the Arduino Duo, but Version 2.x of the Arduino Joystick Library does not work with Arduino Due at this time.
220
+
-[Arduino Due](https://www.arduino.cc/en/Main/ArduinoBoardDue) - NOT Supported - I have been told that the old Arduino IDE 1.6.5 (and below) version of this library (see [Add USB Game Controller to Arduino Leonardo or Micro](http://mheironimus.blogspot.com/2015/03/add-usb-game-controller-to-arduino.html))
221
+
works with the Arduino Due. I have also been told Version 1.x of the the Arduino Joystick Library will work with the Arduino Duo. However, Version 2.x of the Arduino Joystick Library does not work with Arduino Due at this time.
205
222
-[Arduino UNO](https://www.arduino.cc/en/Main/ArduinoBoardUno) - NOT Supported - However, it might work with the [NicoHood/HoodLoader2](https://github.com/NicoHood/HoodLoader2) library, but I have not had a chance to try this out yet.
206
223
-[Arduino MEGA](https://www.arduino.cc/en/Main/ArduinoBoardMega2560) - NOT Supported - However, it might work with the [NicoHood/HoodLoader2](https://github.com/NicoHood/HoodLoader2) library, but I have not had a chance to try this out yet.
0 commit comments