Arduino default sketch change

Simple here.. talking about this one:

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

}

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

}

Is it there any way to change it to code that i want?
Thanks

Yes, I'm sure it's possible.

I'm not sure where it's pulling that from, though - Is it just grabbing the bareminimum example? Does modifying that make a difference?

Odd request though - I take it this is for teaching a class on Arduino or something like that, where you need to give the students a starting point that has some stuff for whatever they're working with?

DrAzzy:
Is it just grabbing the bareminimum example? Does modifying that make a difference?

Yep. That's the one.

I've modified my template too, to reflect the way I like to lay out a program. I just edit the name and date, add details as required, then delete any sections I don't use:-

/* BareMinimum.ino
*  Written by Steve Carroll, 4.2.2016
*  
*  Processor:-
*  Notes:-
* 
*/

// Libraries:-


// Defines:-


// Pin allocations:-


// Constants:-


// Global variables:-


// Class objects:-


void setup()
{

}

void loop()
{

}

Today I made some sketches for test and all of them had same stuff on it and i was wondering if i can get something like this for starting sketch:

/*
  Author:
  Date:
  Sketch: ""
  Info:
*/
#include <Servo.h>
#include <SoftwareSerial.h>
#include "arduino_uno_pins.h"
#include "motors.h"

void setup() {
  pinMode(LEFT_MOTOR_DIR, OUTPUT);
  pinMode(RIGHT_MOTOR_DIR, OUTPUT);
  pinMode(LEFT_MOTOR_PWM, OUTPUT);
  pinMode(RIGHT_MOTOR_PWM, OUTPUT);
  pinMode(button, INPUT);
  while(digitalRead(button) != 0)
}

void loop() {
  }

Like OldSteve I have modified the template to suit my needs. In order to do it I had to mess with file permissions if I remember correctly but it was not difficult. Using Windows 7

yordanganev:
Today I made some sketches for test and all of them had same stuff on it and i was wondering if i can get something like this for starting sketch:

#include <Servo.h>

#include <SoftwareSerial.h>
#include "arduino_uno_pins.h"
#include "motors.h"

void setup() {
 pinMode(LEFT_MOTOR_DIR, OUTPUT);
 pinMode(RIGHT_MOTOR_DIR, OUTPUT);
 pinMode(LEFT_MOTOR_PWM, OUTPUT);
 pinMode(RIGHT_MOTOR_PWM, OUTPUT);
 pinMode(button, INPUT);
 while(digitalRead(button) != 0)
}

void loop() {
 }

You could put it in the "BareMinimum.ino" file, but then every sketch you create will start with that exact code.
For something that specific, I'd stick with a copy/paste each time personally.

Great! I can get rid of the useless comments!

UKHeliBob:
Like OldSteve I have modified the template to suit my needs. In order to do it I had to mess with file permissions if I remember correctly but it was not difficult. Using Windows 7

That's right, it asks you to save it to a different location.

I just copy the original, make any required changes, then replace the original with the modified copy. No need to mess with permissions to do it that way.

aarg:
Great! I can get rid of the useless comments!

Yep - that's why I originally did it. :slight_smile:

My BareMinimum.ino file is blank for quickly pasting a copied file from the forum but I have this:

void setup() {
  
}

void loop() {
  
}

In a file named "minimum.ino" in my examples folder for a quick grab.

outsider:
My BareMinimum.ino file is blank for quickly pasting a copied file from the forum....

For that, I just create a new file, Ctrl+A to "Select All", than paste the forum sketch to replace the default stuff.