use variables in blink sketch

After changing again three times in a row 13 to whatever i need to blink as a test, I thought it would be a good idea to have the blink demo use variables for the pin and blink tempo. below my suggestion for a new version of the sketch:

/*

int ledPin = 13;
int blinkTime = 1000;

// the setup function runs once when you press reset or power the board

void setup() {
  // initialize digital pin 13 as an output.
  pinMode(ledPin, OUTPUT);
}

// the loop function runs over and over again forever

void loop() {
  digitalWrite(ledPin, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(blinkTime);              // wait for a blinkTime milliseconds
  digitalWrite(ledPin, LOW);    // turn the LED off by making the voltage LOW
  delay(blinkTime);              // wait for a blinkTime milliseconds
}

Your sketch starts with a comment, but I can't see where the comment ends I also can't see the code tags.

Oops sorry, wrong paste. here the full code. what do you mean with code tags?

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://arduino.cc

  This example code is in the public domain.

  modified 
  20140508  by Scott Fitzgerald
  20150619 by Simon Claessen
 */

int ledPin = 13;
int blinkTime = 1000;

void setup() {
 
  pinMode(ledPin, OUTPUT);  // initialize ledPin as an output.
}

// the loop function runs over and over again forever

void loop() {
  digitalWrite(ledPin, HIGH);   // turn ledPin on (HIGH is the voltage level)
  delay(blinkTime);              // wait for a blinkTime milliseconds
  digitalWrite(ledPin, LOW);    // turn ledPin off by making the voltage LOW
  delay(blinkTime);              // wait for a blinkTime milliseconds
}

what do you mean with code tags?

You managed to find the TTY tags, but not code tags? :o

The Arduino team seem to be going for simplicity. If you take a look at this difference file, you'll see that the pin number was once a variable, but was removed in favor of directly writing the pin number.

https://github.com/arduino/Arduino/commit/9ad8748d40ad0033abd9431335af93bdf9ca5e4f

He is talking about the the time variable should be added, keeping the pin number same. Right?

We can add a time variable then leave everything else same. But why add more complexity to a code intended for a beginner? The code is enough. If someone needs a variable he can modify the rest of the code of his own.

Pinaki_Gupta_1982: He is talking about the the time variable should be added, keeping the pin number same. Right?

Both, the pin number is hard coded also. I would leave such a basic example as is.

The next example "DigitalReadSerial" shows how to use a variable for pin numbers.

// digital pin 2 has a pushbutton attached to it. Give it a name: int pushButton = 2;

Maybe a good change would be using a more appropriate type like ``` const byte ``` .

No, no need. Leave it as it is. Making things complicated is not our philosophy. After all Arduino is meant for all, a starter and for a pro also. Let people make their code advance.