Upload fails only when a part is connected to pins 0 and 1
- Arduino Uno
- HC-05 / HC-06
- 7-segment display
You may see
Why it happens
- The board receives new code on pin 0 (RX) and answers on pin 1 (TX).
- Anything wired there can hold the line high or low.
How to fix it
- Unplug the wires on pins 0 and 1.
- Upload the code.
- Plug the wires back in.
- Better: move the part to other pins and change the code (SoftwareSerial for Bluetooth).
It worked if: Upload succeeds with the two wires out, and the project still works after you put them back.
From the official documentation. From Arduino Support (remove connections to pins 0 and 1). Sources: Arduino Support: 'Error: avrdude' when uploading.
Didn't help? Search another error or ask us.

