Arduino USB Interface to USB joystick/game pad

This is the USBJoystick library. It provides an Arduino library and class for reading input from a USB joystick/game pad, such as Logitech 'Dual Action' game pad. It can be subclassed to get control when new input values are read, or when they actually change. Alternatively, you can set up callback functions to be called when new input values are read, or when they actually change.

The version of the package that this documentation refers to can be downloaded from You can find the latest version at



This library does not steal any timers or add any interrupt handlers.

Example programs

Example Arduino programs are included to show the main modes of use.

The following example programs are provided:


Install in the usual way: unzip the distribution zip file to the libraries sub-folder of your sketchbook.

If you are using the older Sparkfun DEV-09628 USB Host Shield, you will need to alter the pin definitions in Max3421e_constants.h in the USB_Host_Shield library as discussed in

If you require the USB Host Shield to be installed with WiShield, expect pin conflicts. These can be resolved by Bending the USB Host Shield pins D8, D9 and D10 out of the way and then jumpering Host Shield D10 to D6, Host Shield D9 to D3, Host Shield D8 to D5, then changing the settings in Max3421e_constants.h like this (for the older Sparkfun DEV-09628 USB Host Shield). See this photo showing Duemilanove, WiShield and USB Host Shield stack.

// For USB Host Shield DEV-09628 interop with WiShield
#define MAX_SS 6
#define MAX_INT 3
#define MAX_GPX 7
#define MAX_RESET 5

This library has been tested with Duemilanove and SparkFun USB Host Shield DEV-09628, with the Logitech 'Dual Action' USB Game Pad P/N 863247-0010 compiled with arduino-0021 on OpenSuSE 11.1 and avr-libc-1.6.1-1.15, cross-avr-binutils-2.19-9.1, cross-avr-gcc-4.1.3_20080612-26.5.

Mike McCauley (

This software is Copyright (C) 2011 Mike McCauley. Use is subject to license conditions. The main licensing options available are GPL V2 or Commercial:

Open Source Licensing GPL V2
This is the appropriate option if you want to share the source code of your application with everyone you distribute it to, and you also want to give them the right to share who uses it. If you wish to use this software under Open Source Licensing, you must contribute all your source code to the open source community in accordance with the GPL Version 2 when your application is distributed. See
Commercial Licensing
This is the appropriate option if you are creating proprietary applications and you are not prepared to distribute and share the source code of your application. Contact for details.
Revision History
1.0 Initial release
1.1 Compiles under Arduino 1.0 PROVIDED: you modify (or update) the USB_Host_Shield library so it builds under 1.0 too. At the time of writing there was no update to USB_Host_Shield available for 1.0.
1.2 Updated author and distribution location details to