0

Code changed, but upload runs old version!
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Code changed, but upload runs old version!

by barneystone on Thu Aug 08, 2019 12:13 pm

This has happened to me twice now. I write some code, and it compiles, uploads and runs fine. I come back to it the next day. Make a few code changes. Suddenly it won't compile. I have to make a lot of capitalization changes to get it compile. For example, int ScanCount won't compile, but int scanCount will. Also makes me capitalize Setup and Loop. Finally get it compiling again. Now it gets REALLY weird. I upload the revised code to an Arduino Mega 2560. But it still runs the older code! I can make obvious changes, such as text in Serial.println statements, and the old text keeps appearing. I can upload and run a completely different program with no problems. Then re-upload the problem code, and it still runs the old version! Try it with a different Mega 2560 - same problem. If I copy and past the whole program to a new project, change setup and loop back to lower case, and upload it to the same Mega 2560, it runs fine.

Anybody have a clue as to what is going on? I've done a fair amount of Arduino programming over the last few years, and until the last few days, have never seen anything like this before. Thanks for any help you can provide.
barneystone
 
Posts: 20
Joined: Sun Aug 18, 2013 10:58 am

Re: Code changed, but upload runs old version!

by adafruit_support_carter on Thu Aug 08, 2019 1:28 pm

Can you post full code for the most simple sketch that demonstrates this issue.

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Re: Code changed, but upload runs old version!

by barneystone on Thu Aug 08, 2019 2:11 pm

I've cut the code down to basically nothing (see below). I upload it with no errors (editor says "Done Uploading"). The original code, which detects touches on a resistive touchpad and displays their location on the serial monitor, still runs and displays its output.

In the window that shows all of the compiling steps, it is still referencing the libraries that the original code - before I deleted almost all of it - required. Somehow it is ignoring the current version of the code, and continuing to compile and upload a previous version.

Code: Select all | TOGGLE FULL SIZE
void Setup() {
  Serial.begin(9600);
 
Serial.println("testing");


void Loop() {}
barneystone
 
Posts: 20
Joined: Sun Aug 18, 2013 10:58 am

Re: Code changed, but upload runs old version!

by adafruit_support_carter on Thu Aug 08, 2019 2:17 pm

Can you clarify what is happening here:
If I copy and past the whole program to a new project, change setup and loop back to lower case, and upload it to the same Mega 2560,
it runs fine.

So if you do that, it then works as expected?

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Re: Code changed, but upload runs old version!

by barneystone on Thu Aug 08, 2019 2:44 pm

Correct. If I paste the problem code into a new project and fix the case of setup() and loop(), it uploads and runs fine. If I go back to the original project, and delete all but the code I inserted above, it still has the same problem - it still compiles and uploads the original full program.
barneystone
 
Posts: 20
Joined: Sun Aug 18, 2013 10:58 am

Re: Code changed, but upload runs old version!

by adafruit_support_carter on Thu Aug 08, 2019 3:01 pm

Does that fix work for the blink sketch also? Like can you use that same approach, load blink, change delay, load blink again, etc.?

adafruit_support_carter
 
Posts: 12975
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.