This library enables connecting BLE (Bluetooth Low Energy) gamepads to ESP32 boards. Supported gamepads include the Xbox Wireless Controller and the Steam Controller.
- Open Arduino Library Manager: Tools -> Manage Libraries.
- Search for
BLE-Gamepad-Clientand install it.
Add the following line to the lib_deps option of platformio.ini file.
tbekas/BLE-Gamepad-Client@^0.12.1Both Xbox One Wireless Controllers (models with 2 buttons: 1697 and 1708) and Xbox Series S/X Wireless Controllers (models with 3 buttons: 1914 and newer) are supported.
Update (or verify) controller firmware to version 5.x using these instructions: Update your Xbox Wireless Controller.
#include <Arduino.h>
#include <BLEGamepadClient.h>
XboxController controller;
void setup(void) {
Serial.begin(115200);
controller.begin();
}
void loop() {
if (controller.isConnected()) {
XboxControlsState s;
controller.read(&s);
Serial.printf("lstick: %.2f,%.2f, rstick: %.2f,%.2f\n",
s.leftStickX, s.leftStickY, s.rightStickX, s.rightStickY);
} else {
Serial.println("controller not connected");
}
delay(100);
}- Turn on your controller by pressing the Xbox button.
- Press and hold the controller’s pair button for 3 seconds, then release.
Install BLE firmware using these instructions: Steam Controller BLE.
#include <Arduino.h>
#include <BLEGamepadClient.h>
SteamController controller;
void setup(void) {
Serial.begin(115200);
controller.begin();
}
void loop() {
if (controller.isConnected()) {
SteamControlsState s;
controller.read(&s);
Serial.printf("stick: %.2f,%.2f, lpad: %.2f,%.2f, rpad: %.2f,%.2f\n",
s.stickX, s.stickY, s.leftPadX, s.leftPadY, s.rightPadX, s.rightPadY);
} else {
Serial.println("controller not connected");
}
delay(100);
}- Turn on your controller by pressing the Steam button while holding the Y button.
- h2zero for the excellent NimBLE-Arduino library, which this library is built upon.


