Posted on

How To Program The Pro Micro (atmega32u4) As A USB Gamepad Controller With Arduino

This tutorial should work on any Arduino Leonardo compatible board like the Sparkfun Pro Micro and the cheaper Pro Micro clones on ebay or Aliexpress with the QFN or TQFP chip package. They’re all the same. I highly recommend the Pro Micro clone in a TQFP package as they are less likely to have shorted pins than the popular QFN package with smaller atmega32u4 chips. I bought hundreds of those TQFP Pro Micros and never had any problem with them while I usually get lots of shorted pins from those QFNs.

Let’s Get Started (Microsoft Windows):

    1. First, download and install the latest Arduino IDE at https://www.arduino.cc/en/Main/Software.
    2. Run the software, create a new file, copy and paste the code from http://www.tinkerboy.xyz/arduino-usb-gamepad/.
    3. Now let’s install the Arduino Joystick Library. Download the library. On Arduino IDE, click on Sketch > Include Library > Add .ZIP Library…, browse to the zip file you downloaded and click Open. A message should appear at the bottom telling you that “Library added to your libraries. Check “Include library” menu“.
    4. Plugin in the Pro Micro with a micro usb data cable and let Windows install the device. Take note of the COM port number used by the device (COM9 in this example).
    5. Now on Arduino IDE, click on Tools > Board > Arduino Leonardo.
    6. Click on Tools again, choose Port and the port used by your Pro Micro.
    7. Finally, click the Upload button or press CTR + U to flash/program the Pro Micro. You should see “Done uploading.” at the bottom if it’s successful.

Here’s how to enable Analog Stick support.

Comment below if this tutorial works for you or not.

5 thoughts on “How To Program The Pro Micro (atmega32u4) As A USB Gamepad Controller With Arduino

  1. Programmed my Pro Micro I bought from EBay with the code above and it works great. Thank you!

  2. Thank you! Great tutorial!

  3. This is what Im getting….

    Arduino: 1.8.4 (Windows 7), Board: “Arduino/Genuino Uno”

    C:\Users\hp\Documents\Arduino\sketch_apr04c\sketch_apr04c.ino:6:22: fatal error: Joystick.h: No such file or directory

    #include

    ^

    compilation terminated.

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    “Show verbose output during compilation”
    option enabled in File -> Preferences.

    1. Manually adding the library should do it.

  4. I think they must’ve changed the file structure. I couldn’t add it as a .zip file, because it kept saying it didn’t contain a valid library. But if you unzip it and read the README.md file, it says to copy the Joystick folder to the Arduino\libraries folder (under My Documents). Then when you restart Arduino it sees it as a library and the sketch compiles.

Leave a Reply

Your email address will not be published. Required fields are marked *