by Thomas Brady in ,

So, uh, yeah...

I seem to have done that oh-so popular thing where you abandon your blog and only tweet from time to time instead of having fully-formed thoughts.

Well, this didn't fit into a tweet, so, I'm back! I hope.

If you ever, say, write a sketch to an Arduino Leonardo that randomly sends keyboard and mouse input to a host computer, for the purpose, let's say, of making that person think that their keyboard, mouse and/or computer are malfunctioning, you might later find out that if you didn't wrap the HID-mode stuff in your Arduino sketch in some sort of enable/disable functionality that it's now nearly impossible to write new sketches to the Leonardo.

If you do find yourself in such a pickle, and you happen to have an AVR Dragon (or similar), here's the way forward: install avrdude (brew install avrdude if you're on a real computer) if you haven't already and issue a commmand similar to this one (I leave it to your capable hands to change what needs to be changed):

avrdude -v -patmega32u4 -cdragon_isp -Pusb -Uflash:w:/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/bootloaders/caterina/Leonardo-prod-firmware-2012-12-10.hex:i -Ulock:w:0x2F:m