All Projects → gamelaster → ArduinoGamepad

gamelaster / ArduinoGamepad

Licence: other
A GamePad HID library for Arduino Pro Micro/Leonardo (ATMega32u4)

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to ArduinoGamepad

Arduinojoysticklibrary
An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.
Stars: ✭ 1,162 (+1660.61%)
Mutual labels:  arduino-library, gamepad
Segacontroller
Arduino library to read Sega Genesis (Mega Drive) and Master System (Mark III) controllers.
Stars: ✭ 55 (-16.67%)
Mutual labels:  arduino-library, gamepad
qp-arduino
QP real-time embedded frameworks/RTOS for Arduino (AVR and SAM)
Stars: ✭ 37 (-43.94%)
Mutual labels:  arduino-library
gfx demo
GFX Demo for Arduino and the ESP-IDF
Stars: ✭ 63 (-4.55%)
Mutual labels:  arduino-library
Arduino-Shell
RPN Postscript/Forth Command Shell for Arduino
Stars: ✭ 19 (-71.21%)
Mutual labels:  arduino-library
PMserial
Arduino library for PM sensors with serial interface
Stars: ✭ 41 (-37.88%)
Mutual labels:  arduino-library
gamepad.js
A simple HTML5 Gamepad handler that provides keyboard-like events for Gamepad sticks and buttons.
Stars: ✭ 21 (-68.18%)
Mutual labels:  gamepad
Queue
Queue handling library (designed on Arduino)
Stars: ✭ 73 (+10.61%)
Mutual labels:  arduino-library
LiquidCrystal I2C
This is an Arduino library for HD44780 LCD display, operated in 4 bit mode over I2C bus with 8-bit I/O expander PCF8574
Stars: ✭ 20 (-69.7%)
Mutual labels:  arduino-library
DCCpp
This is the library version of DCC++ for Arduino, to control railroading DCC devices.
Stars: ✭ 18 (-72.73%)
Mutual labels:  arduino-library
ModularSensors
An Arduino library to give environmental sensors a common interface of functions for use with Arduino-framework dataloggers, such as the EnviroDIY Mayfly.
Stars: ✭ 63 (-4.55%)
Mutual labels:  arduino-library
ServoTimer2
ServoTimer2 is a simple library for Arduino 1.x that does not use Timer1 in case of a conflict.
Stars: ✭ 29 (-56.06%)
Mutual labels:  arduino-library
SparkFun SerLCD Arduino Library
A library to seamlessly control the SparkFun SerLCD over I2C, SPI, and Serial.
Stars: ✭ 18 (-72.73%)
Mutual labels:  arduino-library
nesemu
NES Emulator written in TypeScript https://tyfkda.github.io/nesemu/
Stars: ✭ 47 (-28.79%)
Mutual labels:  gamepad
SerialTransfer
Arduino library to transfer dynamic, packetized data fast and reliably via Serial, I2C, or SPI
Stars: ✭ 273 (+313.64%)
Mutual labels:  arduino-library
joypad.js
JavaScript library that lets you connect and use various gaming controllers with browsers that support the Gamepad API. Less than 5KB in size with zero dependencies and support for button press, axis movement events and vibration play effect.
Stars: ✭ 97 (+46.97%)
Mutual labels:  gamepad
Adafruit CCS811
Arduino driver for CCS811 digital gas sensor
Stars: ✭ 60 (-9.09%)
Mutual labels:  arduino-library
library-registry
Arduino Library Manager list
Stars: ✭ 95 (+43.94%)
Mutual labels:  arduino-library
ps2dev
Arduino library to emulate PS2 keyboard/mouse
Stars: ✭ 67 (+1.52%)
Mutual labels:  arduino-library
FlexyStepper
Stepper motor control library for Arduino supporting in motion changes
Stars: ✭ 41 (-37.88%)
Mutual labels:  arduino-library

ArduinoGamepad

A GamePad HID library for Arduino Pro Micro/Leonardo (ATMega32u4) This library works only on Arduino IDE 1.6.6 or higher!

How to install

Create a new directory named "Gamepad" in Documents > Arduino > libraries, and copy all files from repository into that directory

How to make a Gamepad

http://www.instructables.com/id/Arduino-LeonardoMicroATMega32u4-As-GamepadGame-Con/

Small example

//Including a library
#include <Gamepad.h>

//Initializing a Gamepad
Gamepad gp;

int buttonIndex = 0;
bool setState = true;

void setup() {

}

void loop() {
  gp.setButtonState(buttonIndex++, setState);
  if(buttonIndex == 16)
  {
    setState = !setState; //negate the value
    buttonIndex = 0;
  }
  delay(500);
}

How to test gamepad

  • Just try a game what supports a normal GamePad (not X360, if you want to play game whats support only X360, use X360CE)
  • Or use a Windows Devices "Tester" (where is option to calibrate a GamePad, but I recommending a Arduinos calibration in example project): Go to Control Panel > Devices and Printers and search your device (for me its a Arduino Leonardo) > Right click > Settings of game device > Properties > Test

Functions reference

Gamepad(bool useZRx = false)

Initializing a USB HID Descriptor

  • boolean useZRx (default false): Z is used to represent the right stick’s X axis, Rx is used to represent the right stick’s Y axis. This doesn’t make sense but this is how most existing USB game pads work. I have tested this using Battlefield Bad Company 2, it works. SOURCE

sendUpdate()

Sending a update report, its not needed to use, its executed automatically

setButtonState(uint8_t button, bool state)

Setting a Button State

  • uint8_t button - Number of button (0 - 15), Button #1 is 0, Button #2 is 1 etc...
  • bool state - true is pressed, false is released

setLeftXaxis(uint8_t axis)

Setting an "axis" for Left Thumbstick X Axis

  • uint8_t axis - a value from -127 to 127, when 0 means center (you must format a values from real Thumbsticks to this ranges)

setLeftYaxis(uint8_t axis)

Setting an "axis" for Left Thumbstick Y Axis

  • uint8_t axis - a value from -127 to 127, when 0 means center (you must format a values from real Thumbsticks to this ranges)

setRightXaxis(uint8_t axis)

Setting an "axis" for Right Thumbstick X Axis

  • uint8_t axis - a value from -127 to 127, when 0 means center (you must format a values from real Thumbsticks to this ranges)

setRightYaxis(uint8_t axis)

Setting an "axis" for Right Thumbstick Y Axis

  • uint8_t axis - a value from -127 to 127, when 0 means center (you must format a values from real Thumbsticks to this ranges)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].