Code Monkey home page Code Monkey logo

arduino-xboxcontrollernotificationparser's Introduction

arduino-XboxControllerNotificationParser

A library for arduino to parse notification from a xbox series X or S controller.

This library is parser. If you want to handle controller of xbox series X or S with ESP32, use XboxSeriesXControllerESP32_asukiaaa instead.

Setup

Arduino IDE

Open library manager (Sketch -> Include library -> Manager libraries) then search XboxControllerNotificationParser and install it.

PlatformIO

Add XboxControllerNotificationParser as lib_deps in platformio.ini like this.

lib_deps = XboxControllerNotificationParser

Usage

Include.

#include <XboxControllerNotificationParser.h>

With using NimBLE-Arduino.

XboxControllerNotificationParser xboxNotif;

void notifyCB(NimBLERemoteCharacteristic* pRemoteCharacteristic, uint8_t* pData,
              size_t length, bool isNotify) {
  xboxNotif.update(pData, length);
}

Print info.

Serial.print(xboxNotif.toString());

You can call these variables like this.

if (xboxNotif.btnA) {
  Serial.println("A is pressed");
}
Variable type role
btnA bool State of A button.
btnB bool State of B button.
btnX bool State of X button.
btnY bool State of Y button.
btnLB bool State of left back button.
btnRB bool State of right back button.
btnSelect bool State of select button.
btnStart bool State of start button.
btnXbox bool State of xbox button.
btnShare bool State of share button.
btnLS bool State of left stick button.
btnRS bool State of right stick button.
btnDirUp bool State of direction up button.
btnDirRight bool State of direction right button.
btnDirLeft bool State of direction left button.
btnDirDown bool State of direction down button.
joyLHori uint16_t Value of horizontal directoin of left joystick.
min: 0 (left). max: 0xffff (right).
joyLVert uint16_t Value of vertical directoin of left joystick.
min: 0 (up). max: 0xffff (down).
joyRHori uint16_t Value of horizontal directoin of right joystick.
min: 0 (left). max: 0xffff (right).
joyRVert uint16_t Value of vertical directoin of right joystick.
min: 0 (up). max: 0xffff (down).
trigLT uint16_t Value of left triger.
min: 0. max: 0x3ff.
trigRT uint16_t Value of right triger.
min: 0. max: 0x3ff.

License

MIT

References

arduino-xboxcontrollernotificationparser's People

Contributors

asukiaaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

arduino-xboxcontrollernotificationparser's Issues

Configurable retry count and delay between connection

Hi

I have issues with the connection. Don't know why but especially in case that class is created dynamically on heap via New it sometimes makes problems connecting.

I found that increasing the delay and number of tries really helped in this situation.

What about having these two config items as properties on a class or optional #defines in code ?

Can I do a pull request?

be
Radek

image

Battery level

Is it possible to get information about Xbox Controller battery charge level?

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.