Menu item "File" as in creating new file.

When you start and want to create a new file as shown here you get the basics:

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}

How would I add basic setup info, of my choosing, to the template?

Good question, I'd like to be able to do that as well.

-jim lee

The code is the code of the bare minimum example.

Not behind a pc at this moment, but you can locate bareminimum.ino on your pc and modify it.

To expand on sterretje's answer: File > New adds the text from the BareMinimum example sketch to the newly created sketch. The Arduino IDE doesn't allow you to save edits to example sketches so you use a text editor to change it. The easiest way to find the BareMinimum example is:

  • File > Examples > 01.Basics > BareMinimum
  • Sketch > Show Sketch Folder
  • Open BareMinimum.ino in a text editor.
  • Make your desired changes.
  • Save the file

Note that the changes will be lost every time you update to a new version of the Arduino IDE. You might save a copy of the file in a safe place to make it easy to redo your changes after each update.

Nice!

I am so sick of being reminded " // put your setup code here, to run once:" &c.

On the MacOS, the minimum sketch (and all examples) are in the application itself: click it open with the control key held and "Show Package Contents", navigate to

(Arduino.app/Contents/) Java/examples/01.Basics/BareMinimum

The first BareMinimum I found was just a regular file and was distinctly not what I get with "new".

HTH

a7

ON a Mac, its a little different..

Find the Arduino application icon in the applications folder

Control-click the application icon to bring up the mysterious function menu.

Select "Show contents" from that menu to see all the bits that are hidden from you.

In that contents folder, locat the Java folder, open that.

In the the Java folder, locate the examples folder..

In the examples folder locate.. whewh! the BareMinimum folder and in there? You will find BareMinimum.ino

Edit that, save and.. (Just tested this.)

You have just what you asked for. New files start as you wish, Sir.

-jim lee

jimLee:
ON a Mac, its a little different..

Are you saying the "Show sketch folder" technique I described in my previous reply doesn't work on macOS?

pert:
The easiest way to find the BareMinimum example is:

  • File > Examples > 01.Basics > BareMinimum
  • Sketch > Show Sketch Folder
  • Open BareMinimum.ino in a text editor.
  • Make your desired changes.
  • Save the file

Note that the changes will be lost every time you update to a new version of the Arduino IDE. You might save a copy of the file in a safe place to make it easy to redo your changes after each update.

Ha! I looked at what you were doing and just passed it off. (phtt, PC guy) I read your next post and thought, hmm. Really? So I just went and actually looked.

You know what? Your right, your way works on Macs.

I thought I was so smart.

-jim lee

Thanks for confirming. I don't have a Mac so I can only go off my experience with Windows and Linux.