The Arduino IDE always opens with the last sketch. Is there a way to let Arduino always open only with an empty sketch?
Two options:
Edit/create the shortcut to point to an empty sketch. For example:
"C:\Program Files (x86)\arduino-1.8.5\arduino.exe" "C:\Program Files (x86)\arduino-1.8.5\examples\01.Basics\BareMinimum\BareMinimum.ino"
Make a script or batch file that sets a preference to cause the Arduino IDE to start from a new sketch:
"C:\Program Files (x86)\arduino-1.8.5\arduino_debug.exe" --pref last.sketch.count=0 --save-prefs
"C:\Program Files (x86)\arduino-1.8.5\arduino.exe"
This requires a relatively recent version of the Arduino IDE. The downside to this is it makes the load time much slower because it essentially has to start the Arduino IDE twice. Once to set the preference, and once to actually start the IDE. Unfortunately you can't set the preference and start the IDE in the same command.
If you're using a different operating system other than Windows you'll need to make some minor adjustments to the above commands. Most significant is you only need to use arduino_debug.exe for CLI on Windows. With any other OS you can just use the regular arduino executable for both commands.
Hi, the solution I found, was in the Arduino IDE, go to,
-
File then Preferences.
-
At the bottom of the file preference page, there is a file location for (preferences.txt).
-
Click on that, and you will be taken to the ArduinoData directory.
-
In that directory, you will find a text file called preferences.txt
-
Click on that and up comes the text file.
WARNING PLEASE CLOSE THE ARDUINO IDE BEFORE EDITING THIS TEXT FILE.
-
look for the entry, last.sketch.count=0
-
change this entry to, last.sketch.count=1
save and exit
This will call up a new blank sketch, instead of the last sketch, when you next restart IDE.
I hope this will be useful, please reply if it was.
JanRubanowicz:
Hi, the solution I found, was in the Arduino IDE, go to,
File then Preferences.
At the bottom of the file preference page, there is a file location for (preferences.txt).
Click on that, and you will be taken to the ArduinoData directory.
In that directory, you will find a text file called preferences.txt
Click on that and up comes the text file.
WARNING PLEASE CLOSE THE ARDUINO IDE BEFORE EDITING THIS TEXT FILE.
look for the entry, last.sketch.count=0
change this entry to, last.sketch.count=1
save and exit
This will call up a new blank sketch, instead of the last sketch, when you next restart IDE.
I hope this will be useful, please reply if it was.
I changed to 0, not 1, it works!
You also have to change to Read-Only in the preferences otherwise it will just overwrite next time.