Mouse.click() loop problem

Hi Arduino community,
I just started programming with arduino this week with my arduino pro micro, and to test it out, I uploaded a script that goes like this:

void setup() {#include "Mouse.h"

// put your setup code here, to run once:
delay(1000);
}

void loop() {
// put your main code here, to run repeatedly:
Mouse.begin();
if (10 == 10) {
Mouse.click();
}
}

The problem is, my mouse keeps on clicking, so I can't upload another piece of code onto the board, because I have to change the port before I can upload it. All of this means that I basically cannot use my board anymore. Does anyone know what to do to get out of this situation? Thanks so much! :smiley:

Do this:

Unplug your Arduino board from your computer.

Open the sketch you want to upload.

Select the appropriate board from the Tools > Board menu.

Hold down the reset button on your Arduino board. If you have a Pro Micro, there is no reset button, so you’ll need to use a wire to connect the GND and RST pins.

Plug your Arduino board’s USB cable into your computer.

Sketch > Upload

Watch the black console window at the bottom of the Arduino IDE window. When you see something like this:

Sketch uses 3462 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.

release the reset button (or disconnect the wire between the RST and GND pins on the Pro Micro).

The upload should now complete successfully.

You could re-program it using ICSP, but that requires another arduino