When a sketch does a lot of Serial output it can be very hard to upload a new sketch. The uploading program on the PC sends a command to the bootloader and reads a response. The USB input buffer is full of whatever the sketch was sending and that data does not match the expected response. The uploader tries the command a few more times before giving up.
To upload over a sketch that floods the Serial output:
- Hold down the reset button on the Arduino.
- Unplug the USB cable. This causes the PC to flush the USB receive buffers.
- Re-connect the USB cable. (by continuing to hold the reset button we prevent new flooding)
- Begin the new sketch upload.
- WHEN THE RX LED ON THE ARDUINO BLINKS (or you get a 'not in sync' error): release the reset button.
That RX blink is the first upload command being sent to the bootloader. Releasing the Reset button allows the bootloader to be ready for one of the retries of that command.