Paul
Paul

Reputation: 1220

Arduino Leonardo stuck in a loop with infinite keyboard emulation

My Arduino is constantly spitting out keyboard commands after making an accidental error with my code.

Keyboard.write('l');

Now I can't upload any new sketches. I have already tried common Arduino loops solutions like the one from here: How can I "reset" an Arduino board?

The errors I get when trying to upload just before the keyboard starts shooting out code is:

avrdude: stk500_getsync(): not in sync: resp=0x3f

or

avrdude: stk500_recv(): programmer is not responding

It would be great if there is a solution, which wouldn't require buying an external programmer.

Upvotes: 1

Views: 4043

Answers (4)

Lucky Tech Tricks
Lucky Tech Tricks

Reputation: 1

Install ArduinoDroid IDE on the mobile which is available in the play store.

Select the board as Leonardo, connect the Leonardo to the mobile by pressing the reset button on the board and upload the code immediately after removing the thumb on the reset button...

Boom, it worked...

App link: https://play.google.com/store/apps/details?id=name.antonsmirnov.android.arduinodroid2&hl=en

Upvotes: 0

lokers
lokers

Reputation: 2198

For Arduino Yún users, try uploading via Ethernet/Wi-Fi (menu ToolsPort).

Upvotes: 1

Paul
Paul

Reputation: 1220

Finally fixed it :)

The sync problems were caused due to selecting the wrong board in the compiler. I was in fact able to overwrite my program as explained in this Stack Overflow question: How can I "reset" an Arduino board?

It did take several attempts to get the timing right, between releasing the reset button and uploading a new program though.

Upvotes: 1

Peter Bloomfield
Peter Bloomfield

Reputation: 5766

I haven't used a Leonardo myself, but it sounds like the auto-reset may be the problem. Try pressing and holding the reset button, and then (while holding it) upload the sketch.

According to these instructions, you can release the button after the upload has started.

Upvotes: 0

Related Questions