How to protect the computer itself

Your accident has been common since man first drove electron into wire. That's
why fuses were invented in the first place. Early cavemen were always touching

  • wire to - wire to see the big sparks. Electricity is fun.

That being said, ALL of the I/O pins in the typical Arduino board have no overvoltage
or short-circuit protection whatsoever. What works well is using small series-Rs
in "all" I/O lines, of value 220-330 ohms.

Also, I believe if you use a separate supply to power the Arduino bd, rather than
the USB, then overloading the bd should have less disasterous effects on the
PC USB port [but I'm not 100% certain of this].