How to clear arduino pro micro memory?

Hello

I recently uploaded this sketch to my arduino pro micro (mini leonardo)

void setup() {
  // put your setup code here, to run once:
 Keyboard.begin();
}

void loop() {
  // put your main code here, to run repeatedly:
 Keyboard.press('l');
}

I want to know how I can delete it?

note:
-when I plug arduino in my computer it starts spamming the letter l, so I can’t program it from ide.

Simply upload another sketch and it will over write the last one.

That makes it easy for users.
If the sketch is problematic then use BLINK or BARE MINIMUM from the EXAMPLES.

Bob.

His problem is that because it starts spamming the L key he is having trouble programming it.

Assuming the ide was last set to the port that the micro gets, press upload with board disconnected, and then immediately connect it while its compiling.

What you can try

Disconnect the pro micro.
In the IDE, ooen e.g. blink and type // as the first line.
Connect the pro micro, it will spam the IDE but it will be considered a comment by the compiler.
Upload the sketch.
You might have to press or double tap reset once the IDE gives the memory statistics.

PS
build a guard in your code; I use a pin and connect a switch or wire between pin and GND. Use INPUT_PULLUP.
Read the pin and if it's low, send the key. If high (wire disconnected), do not send.

1 Like

sterretje:
What you can try

Disconnect the pro micro.
In the IDE, ooen e.g. blink and type // as the first line.
Connect the pro micro, it will spam the IDE but it will be considered a comment by the compiler.
Upload the sketch.
You might have to press or double tap reset once the IDE gives the memory statistics.

PS
build a guard in your code; I use a pin and connect a switch or wire between pin and GND. Use INPUT_PULLUP.
Read the pin and if it's low, send the key. If high (wire disconnected), do not send.

I made a comment , now arduino displays error 'Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.'

I want to know if there is a option to clear memory without arduino IDE, or if there is a option to upload the code on arduino with using another arduino?

As we can not see your code, it's difficult ot comment on the error.

You can use another Arduino as an ISP to burn the bootloader; tutorials on the web. Never had a need to try it.