Create a XBOX360 gamepad with an arduino
Did you know you can emulate a XBOX360 controller with an Arduino Micro ?
Table of Contents
WARNING ! When you upload your code, you need to reset your board yourself, if you don't do this you can brick your board !
At the end of the year 2018, David Madison (partsnotincluded.com) found a way to transform , for ex. an arduino micro / a makey makey or a teensy into a XBOX controller !
https://www.partsnotincluded.com/programming/arduino-xinput-library/ https://github.com/dmadison/ArduinoXInput
Most Arduino library emulate DirectInput gamepad, unfortunately it doesn't works with most games as Microsoft forced the XINPUT standard (in order to sell more XBOX360 controller on PC)
You can use xbox360ce to make an DirectInput gamepad works, but you need to install it and it doesn't works with all games!
You can't use this libary for commercial use as it imitate an XBOX360 controller, it seems to be illegal to sell a board with this firmware (even if you could just sell your own-made controller without the firmware and explains how to flash it :-) afterwards )
Install Library
If you want to use ArduinoXInput, you need to install it from your library manager.
Install boards
You also need to install new board :
- Download your corresponding boards here (Inside release not directly the code)
- Copy it inside your sketchbook, inside a folder you need to create yourself: hardware (Documents/Arduino/hardware)
Arduino board (Leonardo / Micro / Yun ...)
Sparkfun board (Pro Micro / Fio / Qduino Mini / LilyPad USB Plus)
Teensy board
Search inside the examples to discover how to use it !
My arduino micro is not recognized anymore !
Don't forget to reset your board after each upload, or it could be impossible to upload to it again !
I only test this method with an Arduino Micro 3.3v, so i'm not sure it will works, but here is a way to unbrick your board.
https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/all#troubleshooting-and-faq
Else, you will need to use an external ISCP uploader.
Strange error during compilation
I had this error when I compile my code
cc1.exe: error: -fno-fat-lto-objects are supported only with linker plugin.
I didn't find any information on how to handle this error, but I reinstall completely the Arduino Software, and it was gone.