Hi,
I have written a sketch for the leonardo, I have been uploading new versions with no issue.
Today the sketch would not upload stating that the avrdude programmer is not responding.
I have searched the internet forums and tried all the basic tips for solving this. New usb cable. disconnecting pins 0 and 1. hitting reset during boot. reinstalling the IDE and driver. All to no avail. I have tried rewriting the bootloader using a mega which solves the problem and allows me to upload the sketch to the arduino but only for 1 time, then I am back to the programmer not responding error. If I repeat the bootloader install it works again, but only for 1 time.
Can anyone give me advice on a permanent solution?
You have to hold the button down, then click 'Upload' and continue holding the button down untilUploading is displayed - where you immediately release the Reset button.
What if you hold the Reset button down even before you plug it in?
Or, if you have to re-do the bootloader, again, take a look at implementing a plan to keep the mouse quiet (like if an input is LOW, no mousing).
Just "brainstorming".
It could be an INPUT check in setup(), a DO_WHILE loop where it stays waiting for that INPUT (it's an INPUT_PULLUP) to be HIGH.
You have this INPUT with a jumper to GND, cycle the power and it stays there till the jumper is removed, remove the jumper and life goes on.
Just 'brainstorming'. But then - if the mouse x,y,z would only occur when this INPUT is 'true' (high, low, however you see it) - could be a better deal.
const byte stallJumper = A5; // I used A5, you can use what you decide
byte Removed;
and then
void setup()
{
// ↓ ↓ ↓ My Additions ↓ ↓ ↓
pinMode(stallJumper, INPUT_PULLUP);
do
{
Removed = digitalRead(stallJumper);
}while (!Removed);
// ↑ ↑ ↑ End of MyAdditions ↑ ↑ ↑
Joystick.begin(); // everything the same from hereon
I'm not sure about this --
byte status = mpu.begin();
but. . . anyway.
If the jumper is in place (meaning A5 connected to GND), then it should "freeze" there when power is removed and re-connected ("cycled").
Is that how you did it (previously)?
ok,
Thorugh much trial and error I have found that the avrdude is beig caused by my code somehow.
It is relatedf to updating the oled display. If I comment out the update display custom function the error goes away.
If I increase the delay in the main loop from 50 to 500 also the error goes away.
So I think the oled display is trying to update too frequently and causing the com error...has anyone heard of this before?