Skip to content

ESP32 Library which uses a wii nunchuck/classic controller breakout adapter to read the input from a nunchuck or wii classic controller and outputs them via bluetooth to another device.

Notifications You must be signed in to change notification settings

WouterLoeve/Bluetooth-ESP32-Wii-Classic-Nunchuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bluetooth-ESP32-Wii-Classic/Nunchuck

ESP32 Library which uses a wii nunchuck/classic controller breakout adapter to read out the inputs from a nunchuck or wii classic controller and outputs them via bluetooth to another device. For this we use three libraries:

  1. esp32-wii-nunchuk: Used to communicate with the wii controllers
  2. esp32-BLE-gamepad: Used to connect with a host via bluetooth and send input as HID device
  3. esp-nimble-cpp: Dependency of 2. The first two libraries were originally meant for arduino but where converted to work with the ESP-IDF environment.

How to run

  1. Install esp-idf: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-setup.html
  2. Clone [email protected]:h2zero/esp-nimble-cpp.git from components dir (This should be a submodule....) and execute git checkout tags/1.3.1
  3. Execute idf.py menuconfig
  4. Go to Component config->Bluetooth enable Bluetooth and in Bluetooth host NimBLE.
  5. build and flash your esp32

Customization

  • In menuconfig, set logging level to error. Since the bluetooth library mistakingly logs too much, very frequently. This will cause the (for me blue) LED on the development board to blink fast.
  • You can also set the core of the controller loop function by going to: Menuconfig -> Component Config -> Bluetooth -> NimBLE options.

Troubleshooting

  • If you receive the no-data message the entire time, it might be a timing issue in the loop. Try to put some delay in there as seen in the original wii_i2c code .
  • If your ESP keeps crashing with the message: "main", "-> unknown controller detected, make sure your controller is plugged in correctly.
  • If your ESP has watchdog problems, try increasing delays or open in a pull request with your own version.

Folder contents

The project ESP32-Wii-Classic contains one source file in C++ main.c. The file is located in folder main.

ESP-IDF projects are built using CMake. The project build configuration is contained in CMakeLists.txt files that provide set of directives and instructions describing the project's source files and targets (executable, library, or both).

Below is short explanation of remaining files in the project folder.

├── CMakeLists.txt
├── components
│   ├── /esp32-wii-nunchuck Fork of nunchuck/classic library: https://github.com/moefh/esp32-wii-nunchuk
│   ├── /esp-nimble-cpp  esp nimble BLE library
│   └── /BleGamepad      Fork of Gamepad lib: https://github.com/lemmingDev/ESP32-BLE-Gamepad
├── main
│   ├── CMakeLists.txt         Add any new source files here
│   └── main.cpp                 
└── README.md                  This is the file you are currently reading

About

ESP32 Library which uses a wii nunchuck/classic controller breakout adapter to read the input from a nunchuck or wii classic controller and outputs them via bluetooth to another device.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published