How do I get a new program to load after I've used the Leonardo keyboard library?
I wrote a simple program to emit a keyboard emulation character based on the state of an external switch, and now I can't get the board to respond to the Arduino IDE to replace that program. This new capability seems really great, but not if I brick a Leonardo during development.
It's running fine, spewing keyboard characters, but I can't figure out how to regain control in order to replace the program with a better one.
Did you use a programmer to overwrite the bootloader?
No, I did normal downloading via the USB. Of course, now the serial port is trying to be a keyboard.
How do I jolt the Leonardo into allowing me to re-program it via the USB port?
Is there another way to accomplish this? Can I somehow get back to ground zero?
Alongside, how do I write programs that use the keyboard library and not end up in this troublesome state? Do I need to install a switch that disables whatever I’m doing with the keyboard emulation?
Do I need to install a switch that disables whatever I'm doing with the keyboard emulation?
That seems like a good idea.
You can try forcing the bootloader to run, by pressing the reset button. In your case, you may need to press and hold the button until upload is ready, then release it when avrdude starts.