I'm new to Arduino and having sporadic problems uploading as I've started using Mac Arduino IDE (2.3.8). It worked a few times, but after a few iterations, it would compile, but not upload... hanging with
Error: programmer is not responding; Warning: attempt x of 10: not in sync: resp=0x00
or
Error: unable to write flash (rc = -1)
At one point, I seemed to get it going again by restarting the IDE while simultaneously reseting the Arduino UNO, but that has stopped working too. And that's the problem - I can't find any consistently when it will or won't work. But I do know that I can't really do any experimentation with it in it's current state and am spending way more time just trying to get the code uploaded to the device over actually trying or debugging anything (which is also a problem as I can't get any Serial.print or println's to show in the Output window.
Did I somehow damage the arduino itself? Is there any way to tell? How can I figure out where the problem lies? Is there a better IDE I should use? Any tips at all would be really appreciated. Thx!
Here's the very short and not very useful code that I can no longer get to upload at all.
long duration;
int distance;
const int lightPin = 5;
const int trigPin = 10;
const int echoPin = 11;
void setup() {
// put your setup code here, to run once:
pinMode(lightPin, OUTPUT);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
//Serial.begin(115200);
//Serial.print("Hello");
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(lightPin, HIGH);
delay(1000);
digitalWrite(lightPin, LOW);
delay(1000);
/*
digitalWrite(trigPin, HIGH);
delayMicroseconds(2);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance - duration * 0.032/2;
Serial.print("Distance: ");
Serial.println(distance);
*/
}
Hi @briand19. You described the Arduino board you are uploading to as "Uno". Something that can be confusing is there are multiple boards with "UNO" in their name. We need to be certain of exactly which one you have. The reason is that the problem might be caused by the IDE not being correctly configured for your specific board.
Please tell us which of the following boards you are attempting to upload to:
If you aren't sure which one you have, you can provide a picture of the board or a link to the place you bought it from and we'll see if we can identify it.
Thanks Ptillisch for your help. It's an R3.
I'm going to ask you to provide the full verbose output from an upload attempt.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
- Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
- Uncheck the box next to Show verbose output during:
☑ compile in the "Preferences" dialog.
- Check the box next to Show verbose output during: ☐ upload.
- Click the "OK" button.
The "Preferences" dialog will close.
- Attempt an upload, as you did before.
- Wait for the upload to fail.
- You will see an "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
- Open a reply here on this forum topic by clicking the "Reply" button.
- Click the
<CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the error output from the upload into the code block.
- Move the cursor outside of the code block markup before you add any additional text to your reply.
- Click the "Reply" button to publish the post.
Here it is. Again, thanks for your help!
Sketch uses 992 bytes (3%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
"/Users/brian/Library/Arduino15/packages/arduino/tools/avrdude/8.0.0-arduino1/bin/avrdude" "-C/Users/brian/Library/Arduino15/packages/arduino/tools/avrdude/8.0.0-arduino1/etc/avrdude.conf" -v -V -patmega328p -carduino "-P/dev/cu.usbmodem1301" -b115200 -D "-Uflash:w:/Users/brian/Library/Caches/arduino/sketches/4744D21EAC6DBEC92509161EF667BC74/sketch_mar24a.ino.hex:i"
Avrdude version 8.0-arduino.1
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS
System wide configuration file is /Users/brian/Library/Arduino15/packages/arduino/tools/avrdude/8.0.0-arduino1/etc/avrdude.conf
User configuration file /Users/brian/.avrduderc does not exist
Using port : /dev/cu.usbmodem1301
Using programmer : arduino
Setting baud rate : 115200
Error: programmer is not responding
Warning: attempt 1 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 2 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 3 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 4 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 5 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 6 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 7 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 8 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 9 of 10: not in sync: resp=0x00
Error: programmer is not responding
Warning: attempt 10 of 10: not in sync: resp=0x00
Error: unable to open port /dev/cu.usbmodem1301 for programmer arduino
Avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
Please try this experiment and then report the results:
This procedure is not intended to solve the problem. The purpose is to gather more information.
- Connect the Arduino board to your computer with a USB cable.
- Press and release the button on the Arduino board that is marked "RESET".
Now please reply here on this forum topic with the answer to the following question:
- Did you see the "L" LED blink multiple times quickly immediately after you released the "RESET" button?