GithubHelp home page GithubHelp logo

nathanweasley / arduinoxinput Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmadison/arduinoxinput

0.0 1.0 0.0 95 KB

XInput library for USB capable Arduino boards

Home Page: http://www.partsnotincluded.com/programming/arduino-xinput-library/

License: MIT License

C++ 100.00%

arduinoxinput's Introduction

Arduino XInput Library

arduino-library-badge Build Status

This library lets you easily emulate an Xbox 360 controller using a USB-capable Arduino microcontroller.

Getting Started

void setup() {
	XInput.begin();
}

void loop() {
	XInput.press(BUTTON_A);
	delay(1000);
	
	XInput.release(BUTTON_A);
	delay(1000);
}

Before the library will work, you must install a compatible boards file that contains the XInput USB descriptors, otherwise the microcontroller won't behave like an XInput device. This is not optional. See the compatible boards section below for more information.

After installing a compatible boards package, you must then download and install the library. Once the XInput library is installed, open up the Arduino IDE and load an example sketch, located in File -> Examples -> XInput (I suggest trying the 'Blink' sketch first). Double-check that you have the correct XInput board selected in the 'Tools' menu, then upload the sketch to your microcontroller.

On Windows, you can test that the sketch is working properly by opening up the joystick control panel (joy.cpl) or by using GamepadViewer.com. If you uploaded the XInput 'Blink' example, the #1 button ('A') should be slowly turning on and off.

Control Surfaces

The library gives you access to the following controls available on the Xbox 360 controller:

  • 10 + 1 Digital Buttons
  • 2 Analog Joysticks (16 bit)
  • 2 Analog Triggers (8 bit)
  • 1 Four-Way Directional Pad (D-Pad)

The library also processes received data, so you can read the status of the controller's 2 rumble motors (8-bit), the assigned player number (1-4), and the index of the current LED animation. Data is sent and received automatically over USB.

Compatible Boards

To function as an XInput device, you must use a compatible boards package with XInput USB descriptors. This is not optional. Without these descriptors the library will only function in "debug" mode and the microcontroller will not behave as an XInput device.

The following boards packages are available:

  • Modifies the Arduino AVR core to emulate an XInput device. Includes support for the Arduino Leonardo, Micro, Yun, and more.

  • Provides support for the MaKey MaKey, Pro Micro, Fio, Qduino Mini, and LilyPad USB Plus. Requires the XInput AVR Core boards.

  • Includes an 'XInput' USB mode for the Teensy 3.1, 3.2, 3.5, 3.6, and LC microcontrollers. Requires a preexisting Teensyduino installation.

For a complete list of available packages and compatible boards see the 'supported boards' file. For information on how to add support for another Arduino-compatible board with native USB support, see the documentation on the USB API.

License

This library is licensed under the terms of the MIT license. See the LICENSE file for more information.

arduinoxinput's People

Contributors

dmadison avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.