Sketch Disappears When Closing Ardunio Software.

Having built and used an Arduino based wind simulator to work with my racing simulator now for the last couple of years, recently I’m having an issue when I upload a sketch to the Arduino.

When I first open the Arduino software a blank sketch seems to be loaded. Then when I upload, verify and compile either one of the two sketches I normally use, that newly uploaded sketch will work fine if I minimize the Arduino software. However, if I close the Arduino software and then restart the software, that last uploaded sketch is gone and I’m back to that blank sketch.

I’m stumped as to why this is all of a sudden occurring. I use to only open the Arduino software to change between my two sketches. I’m wondering if my Arduino is now defective? Is there something I can try to reset before replacing it?

Any thoughts, suggestions or ideas will be appreciated. Thanks in advance for your replies.

When you start the IDE it does not read from the Arduino and load it’s sketch .
What you see is determined by settings within the IDE , it loads the last opened sketch from your disc or it doesn’t depending on this setting. If you have starting saving a sketch in a different location , that could be why it’s not now found

Is that what you are saying\seeing ??

Nothing to do with the hardware - the IDE doesn't know or check what is currently on the Arduino.

The Arduino IDE has demonstrated weird behavior w/regards to which sketch automatically opens on startup for me too. Sometimes it behaves the way one would expect, opening the most recently used sketch, other times it will lock onto a sketch and open it every time I start the IDE, regardless of what I've been working on recently. Other times it will open one of the sketches I've worked with recently seemingly at random. Sketches stored on network drives, dropbox, etc, or opening multiple instances of the IDE at once (probably unsurprisingly) tends to provoke stranger behavior.

It's nothing to worry about, just a mild nuisance.

There is a bug in Arduino IDE 1.8.8 that made it not open the last opened sketch, as all previous Arduino IDE versions did:

This bug has already been fixed but there has not been a production release since. If it bothers you, you can use Arduino IDE 1.8.7

You can also use the Arduino IDE Hourly Build:

However, you should be aware that it is intended mainly to be used for beta testing the development work and is more likely to have bugs than the production releases of the Arduino IDE.

Thanks everyone very much for the replies. I am using version 1.8.8 in Windows 10. I've never updated to that version on purpose. I installed the IDE software a couple of years ago and it's always worked great. I actually hadn't used the software for a couple of months until recently. Just curious does the IDE software upgrade automatically, maybe with a Windows 10 update? The update to version 1.8.8 explains why it's now doing what I described and as long as I know how to make it work, and I can, I'm happy enough until the next production version is released. Thanks again for your responses.

I don't know about the Windows App Store version, but certainly no other version of the Arduino IDE does automatic updates.

The IDE does have a feature: File > Preferences > Check for updates on startup, which should notify you when a newer version of the Arduino IDE is available (in addition to new versions of installed libraries and boards packages) but you still need to manually update the IDE. That feature actually doesn't work reliably because Arduino is not consistent about updating the file on their website that indicates what the latest version is. Right now, the file says the latest version is 1.8.7 so if you're using older than 1.8.7 you should get a notification, but if you're using 1.8.7, you wouldn't get a notification that 1.8.8 is available.