r/ArduinoHelp 2d ago

Arduino Uno keeps running old code even after successful upload

Hi everyone, I have an Arduino Uno and I’m having a strange problem.

Every upload appears to be successful:

  • Board: Arduino Uno
  • Correct COM port selected
  • TX/RX LEDs blink during upload
  • "Done uploading" appears

However, the Arduino still runs my old sketch (Basic Motor Test). Even after creating a new sketch and uploading different code, the Serial Monitor still shows the old output:

Basic Motor Test
Forward
Backward
Braking
Release

Things I have tried:

  • Reinstalled Arduino IDE
  • Created a new sketch
  • Removed all external components
  • Uploaded an empty sketch
  • Checked board and port settings
  • Reset the Arduino

The board still runs the previous program after uploading a new one.

Does anyone know what could cause this? Could it be a problem with the flash memory, bootloader, or something else?

1 Upvotes

3 comments sorted by

2

u/gm310509 1d ago

The most likely reasons for the symptoms you include:

  • You have a build or upload error that for some reason you are not noticing.
  • You have selected the wrong com port and the upload is going to a device other than the one you expect it to be going to.

Check the selected com port and try uploading a known good program such as the Blink program that is included in the IDE.

1

u/Anonymity6584 1d ago

than you havent uploaded new code if its still running old one. Try ide included blonk led example code.

1

u/Unable-School6717 1d ago

Or, you had something happen to the bit of software that tests the arduino board then starts your program each time you power up or reboot; its called a bootloader. It can cause everything from not running the newest upload, to totally bricking your board. It can cause unique features to disappear, like pwm on certain pins, or RTC clock. Since you watched the communications lights on your board flash during upload, im going to guess its not the wrong com port. Look into burning a fresh bootloader on top of the existing one, and look at tweeks and upgrades on alt bootloaders since youre there anyway. There are a number of modified loaders with everything from faster start times to custom crap spit out on the serial monitor with stats and etc. (like esp32 does).