My Arduino might be busted.

I unplugged the USB cable during an upload. Now when I plug it in, the rx light blinks on, followed by the L light turning on as the rx turns off and then the L light turning off. This just repeats indefinitely, and the computer doesn't detect the Arduino anymore.

  1. I have tried restarting my PC
  2. my other Arduino works
  3. both are Leonardo, I want to fix the main one because the other one is an Adafruit Itsy Bitsy.
  4. I have tried holding reset on the Arduino
    Any help would be much appreciated. I tried following a tutorial to burn the bootloader over isp with the other Arduino, but it doesn't work yet.

Press upload,
When the sketch size shows, double tap the RESET button

i cant upload to the board, it doesn't show up in the port selector. I shall try it anyway.
Well. It somehow worked. There is a short delay between when I click reset, and when it actually shows up in the port menu. I had to time it right. What is the reasoning behind it not wanting to work before?

Part of the code that you upload to a Leonardo (or any board with native USB) listens to events on the serial port; it's not something that you include but it's there.

If the upload does not complete as was the case for you, that part of the code is gone so it will no longer react to the serial events.

For uploads to those boards, the IDE first opens and closes the serial port with a baud rate of 1200 baud; this forces a reset which activates the boot loader But if the uploaded code no longer contains the part that listens to the serial events, the reset will not happen.

===

Some points

You don't mention your operating system. In Windows you can observe the behaviour in device manager. Normally you will see a 'Arduino Leoardo'; after a reset, you will see a 'Arduino Leonardo (bootloader)' for a while (8 seconds I think).

Further a power cycle will not activate the bootloader; this is different from e.g. Uno/Mega.

Most people use this type of boards to use as a HID; make sure that you don't spam your PC. One way is to add a safety mechanism

// use A0 as a safety pin.
const byte safetyPin = A0;

void setup()
{
  pinMode(safetyPin, INPUT_PULLUP);
  ...
  ...
}

void loop()
{
  // only send stuff if the safety pin is low
  if (digitalRead(safetyPin) == LOW)
  {
    // send keyboard / mouse
    ...
    ...
  }

  ...
  ...
}

Also make sure that you release keys after pressing them. Your PC will remember that you pressed a key. So if you e.g. press , that will be active till such time that the key is released. The result, if you don't release, is that any keypresses from your normal keyboard will have the active. If this happens, there are ways to solve the problem but it is a bit tricky.