USBComposite: Nintendo Switch Controller
Posted: Fri Jan 21, 2022 3:07 am
I've just added a Nintendo Switch Controller to the library. It's pretty straightforward to use. It's based on the HORIPAD USB descriptor because the Switch Pro Controller is too complicated. As a result, it doesn't support gyros, and the joystick resolution is 8-bit instead of 16-bit (which is fine for my intended project which is to use it in my GameCube controller to USB adapter).
E.g:
E.g:
Code: Select all
#include <USBComposite.h>
USBHID HID;
HIDSwitchController controller(HID);
void setup() {
controller.begin();
while (!USBComposite);
delay(1000);
}
void loop() {
controller.X(16);
controller.send();
delay(300);
controller.X(255-16);
controller.send();
delay(300);
controller.X(128);
controller.send();
delay(300);
}