[solved] Old sketch keeps running

Using Arduino Uno Surface mount
Uploaded BLINK.ino (LED on built-in pion13) which works fine.
I made another simple sketch for three LEDS on pins 9-11 and uploaded - no errors in compile, no errors in upload
Old sketch continues to run (LED on 13 blinks) new sketch not running (LEDS on 9-11 are dark).
The only pins used are 9-11 for LEDS. Very simple.

I did re-test:
moved all jumpers from surface-mount to another arduino uno (call #2)
existing sketch = unknown
uploaded same 2nd program of 3 LEDS
works fine.

conclusion: sketch not uploading to arduino #1.
Arduino #1 was working fine three days ago - used about ten different sketches without problems.

What are the troubleshooting steps if new sketch will not replace old?

johnkauffman:
I made another simple sketch for three LEDS on pins 9-11

You are using current limiting resistors on each of those pins? And you remembered to change the pins to OUTPUT.

johnkauffman:
and uploaded - no errors in compile, no errors in upload

The IDE will report "Uploading Done" even if an error occured.

You might want to post your code (putting it between tags) as well as copy/paste the results of the black log window (also in code tags).

johnkauffman:
What are the troubleshooting steps if new sketch will not replace old?

If the sketch appears to upload without error and the previous sketch still runs I can only think of two possibilities:

  1. There are two UNO's attached and the wrong one is selected for upload. Do the TX and RX lights twinkle as expected during the upload?

  2. There is something very wrong with the bootloader. Try re-burning the UNO bootloader to see if that fixes the problem.

No twinkle on 1&0
Only one UNO connected at a time

I accepted the new version of IDE download and am not exactly sure when that happened. Could be between successful day and fails today.
I'm checking procedure to burn boot-loader. Sounds drastic to a newbie.

#1

const int BLUE_PIN = 11;

void setup(){ //===============================================
  pinMode(BLUE_PIN, OUTPUT);}

void loop(){ //===============================================
  digitalWrite(BLUE_PIN, LOW);
  delay(1000);
  digitalWrite(BLUE_PIN, HIGH);
  delay(1000);
}

#2:

int led = 13;
void setup() {                
  pinMode(led, OUTPUT);     
}
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

I'm now testing with even simpler sketches: File/Examples/Basic/Blink
Change delay from 1000 to 300 between tests.
Same problem:
no Tx/Rx twinkle

I tried Tools/burn bootloader on one of the UNOs and got error:
avrdude: usbdev_open(): did not find any USB device "usb"

Sounds like you aren't selecting the right serial port in the tools menu. Which one is selected?

I unplug the UNO when changing hardware. Also now while swapping between UNOs to solve this problem.
Each time before upload I check COM by dropping Tools/Serial and select the one offered. It switches between 11 and 14 but only one is ever available.
Bottom right of IDE then shows "UNO on COM14"
When UNO is unplugged I got error of "Serial Port COMx not found"

Much thanks for applying your experience to this. I'm dead in my tracks and promised to demo Arduino to a friend tonight.

So then change the port selected when the OS gives is a different COM port. The IDE won't "automatically" select a new port when the currently selected port goes away. You wouldn't want that.

When I re-plug in USB and check Tools / Serial Port there is one option (11 or 14) and I take it.
Then when I take another look I get a check at the one option that was selected.
There is never more than one COM option.

I checked Device Manager (win 7) and under ports it shows only one: Arduino UNO on com 11
There is nothing I know of that would interfere - no other devices plugged in other than headphones.

It does seem like you are at the problem.

I tried another test by taking both boards to another computer. Same problem. But there COM options were 3 &7 or 3&8. I tried all combinations of coms and the two UNOs.

I tried having UNO plugged in when start IDE and plugging in after IDE running.

I'm running test with Example/basic/blink and changing the delay to see difference.

Thanks for help.

Tools / Programmer is AVRISP mkII
I also tested some other USB cables and USB ports - same problem.

  1. Stop swapping boards. Often operating systems will give each board a different serial port assignment. So swapping boards back and forth is going to just cause confusion.

  2. Plug in a board, and check device manager to see what com port was assigned to that board. Disconnect the board and verify if the device disappears from device manager. Reconnect the board and verify it gets the same com port you had before.

-- This will allow you to verify that a) a com port is getting assigned and b) which one it is [for that board.]

  1. Launch the Arduino IDE. Verify the correct serial port has a checkmark next to it in the tools menu.

  2. Now try the upload.

It may also be helpful to turn on "Show verbose output" on upload, in the preferences.

It really sounds like you keep changing boards, which is changing the COM port assignment, which the IDE does not track automatically. Your problem is not that the "old program keeps running" it is, you aren't able to upload. So you may want to fix the topic of your thread.

Lastly, the Programmer selection doesn't matter. That only applies if you are trying to burn the bootloader, not upload a sketch.

This is humiliating but must be done......

The fault is completely my own. I thought that Ctrl+R did the upload. A person from SparkFun saw the error.
Of course, using Ctrl+U solves the problem. The intermittent success came on the occasions that I clicked the upload icon instead of keyboard Ctrl+R.

James C4S: Thank you immensely for working on a solution to diagnose and resolve errors in communication from PC to Arduino.

JohnWasser: Thanks for thinking of the possibility of conflict from 2 boards.

Holding my hat in hand..... -John