MIT License

项目介绍

dmadison/ArduinoXInput 是一个托管在 GitHub 上的开源项目,主要使用 C++ 编写,采用 MIT License 许可证,目前获得 439 个 Star、71 次 Fork。

仓库全名
dmadison/ArduinoXInput
开源许可证
MIT License
Star 数
439
Fork 数
71
未关闭 Issue
9

README 摘要

Arduino XInput Library This library lets you easily emulate an Xbox 360 controller using a USB-capable Arduino microcontroller. Getting Started 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…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ArduinoXInput 用什么语言开发?

主要使用 C++ 编写,采用 MIT License 许可证,目前有 439 个 Star。

ArduinoXInput 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 ArduinoXInput 的源码?

可以直接克隆仓库:git clone https://github.com/dmadison/ArduinoXInput.git,默认分支为 master;安装与运行步骤见仓库 README。

ArduinoXInput 最近还在维护吗?

仓库最近一次更新为 2024年2月11日,当前有 9 个未关闭 Issue;Star 数为 439,可作为社区活跃度的参考。

关于

XInput library for USB capable Arduino boards

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
595
价值分
285
活跃状态
活跃

语言占比

C++

Release

README

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 and/or XInput USB type 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 HTML5 Gamepad Tester. 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)

For the full list of control names as used in the library, see the source files.

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:

  • Arduino AVR Core Boards

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

  • SparkFun AVR Boards

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

  • Teensy Boards

    Includes an ‘XInput’ USB mode for the Teensy 3.1, 3.2, 3.5, 3.6, LC, 4.0, 4.1, and MicroMod. 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.

Console Support

Please be aware that none of the currently available board packages support connecting to the console itself. Genuine controllers use a dedicated hardware security chip that handshakes with the console. Arduinos do not have this chip, and its security method has not been (openly) broken.

License

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

评论

暂无评论