I tried to make custom library for my Leonardo to work as a native gamepad, but as it turns out, it isn't as easy as it looks. After i got some code of core arduino and imported it, everything uploaded fine but then Windows stopped recognizing Arduino itself (It is now listed as a Composite USB Device).

Now is there any way to wipe arduino back to its factory settings without need of an external programmer or without need for rewriting arduino drivers? Thanks in advance.


1 Answer 1


The boot loader of the Arduino does not immediately run your application code. Rather it looks at the serial port for semaphore sequence sent by Avrdude. which in turn is started by the Arduino's IDE upload process after compile. Where Avrdude opening the serial port will cause a reset of the Arduino, as to catch the boot loader when sending the semaphore. This above process should work. Regardless of your application code.

immediately after power up or reset of the leo, you should see in your device manager a COMM Port briefly for about 5 seconds and then disappear being replaced with your Game interface. This will do the same for the IDE when uploading.

If this does not occur, it is possible that you may have blanked the boot loader and the application is running directly. Note when programing application by the ISP will blank the boot loader.

It is possible that your IDE's machine, avrdude and the leo's timing is just off and misses. You could attempt to manually reset the leo just after compile and as avrdude starts. In the IDE preferences you can turn on the verbose for both compile and upload to better see when to hit the leo's reset.

This was the way of the old Bluetooth's Arduino's that did not have the DTR of the Serial port tied to the ATmega's reset. Where with the leo, a remote reset is triggered by the serial port opening and closing at 1200 baud. Where here it may be possible that with an application of Game controller the USB CDC virtual serial port cannot be opened at 1200 baud. Hence as above stated, may just need to time the reset.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.