Skip to content

asukiaaa/arduino-XboxControllerNotificationParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages