Arduino took over my computer

I was programing on an Arduino pro micro, and created a sketch that put your mouse to random positions and then clicked with both the left and right sides. I uploaded it and it did what I wanted it to do. Then I unplugged it, and the mouse on the computer kept going, for a while, but eventually stopped. Then I created one that was controlled by a button, and had other safety features. When I plugged in the Arduino to program, it continued to take over my mouse, and then continued to glitch. I connected up a button and reset it, but while doing so my board is not recognized, how do I upload another sketch successfully?

Try pressing the reset button twice rapidly.

I pressed the button twice, but the board isn't recognized, and if I do not continuously press reset, the mouse will start to go in random directions clicking stuff. I will keep trying that though, thanks.

Note Never used a pro micro, only Leonardos.

File -> preferences Enable show verbose output during upload

When you see the upload starting, you should see the IDE looking for the port. Press (or double press?) the reset quickly at that moment in time.

For future, build in a failsafe. E.g.

void setup ()
  pinMode (A0, INPUT_PULLUP);

void loop ()
  if (digitalRead(A0) == LOW)
    // do your mouse / keyboard stuff here

For your HID stuff to work, you need to short A0 (in the above example) to ground. If you want to upload, remove the short.

Thank you, I will try that.

As far as I know the Pro Micro does not have a reset button. Instead use a wire between GND and RST to tap 2 times or install a normally open button between the two pins. The Arduino Micro and Leonardo have reset buttons.