Reference.Delay History

Hide minor edits - Show changes to markup

June 01, 2010, at 10:00 AM by Equipo Traduccion -
Changed lines 3-6 from:

Description

Pauses the program for the amount of time (in miliseconds) specified as parameter. (There are 1000 milliseconds in a second.)

Syntax

to:

Descripción

Pausa el programa por un tiempo determinado (en milisegundos) especificado por un parámetro. Hay 1000 milisegundos en un segundo.

Sintaxis

Changed lines 9-16 from:

Parameters

ms: the number of milliseconds to pause (unsigned long)

Returns

nothing

Example

to:

Parámetros

ms: el número de milisegundos que se desea pausar el programa (unsigned long)

Devuelve

nada

Ejemplo

Changed lines 18-19 from:

int ledPin = 13; // LED connected to digital pin 13

to:

int ledPin = 13; // LED conectado al pin digital 13.

Changed line 22 from:
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
to:
  pinMode(ledPin, OUTPUT);  // declara que el pin digital se va a usar como salida
Changed lines 27-30 from:
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
to:
  digitalWrite(ledPin, HIGH);   // enciende el LED
  delay(1000);                  // espera durante un segundo
  digitalWrite(ledPin, LOW);    // apaga el LED
  delay(1000);                  // espera durante un segundo
Changed lines 35-42 from:

Caveat

While it is easy to create a blinking LED with the delay() function, and many sketches use short delays for such tasks as switch debouncing, the use of delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

Certain things do go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values and pin states are maintained, and interrupts will work as they should.

See also

to:

Advertencia

Aunque es fácil crear un LED parpadeante con la función delay() y muchos sketches usan pausas cortas para estas tareas, el uso de delay() en un sketch tiene problemas importantes. Mientras se pausa el programa no se leen sensores, ni se hacen cálculos, ni puede haber manipulación de los pines. En definitiva, hace que (casi) toda la actividad se pare. Una alternativa para controlar el tiempo es el uso de la función millis() y el sketch mostrado abajo. Normalmente se evita el uso de delay() para tiempos mayores de decenas de milisegundos excepto en programas muy simples.

Algunas cosas siguen funcionando mientras se ejecuta la función delay() porque no se deshabilitan las interrupciones. La comunicación serie de los pines RX sigue funcionando, los valores de PWM (analogWrite) y los estados de los pines se mantienen y las interrupciones siguen funcionando correctamente.

Ver también

Changed lines 45-46 from:
to:
August 15, 2009, at 03:02 PM by David A. Mellis -
Changed lines 1-2 from:

delay(ms)

to:

delay()

Added lines 6-8:

Syntax

delay(ms)

Changed lines 10-11 from:

ms (unsigned long): the number of milliseconds to pause

to:

ms: the number of milliseconds to pause (unsigned long)

February 08, 2009, at 01:32 PM by David A. Mellis -
Added line 41:
February 08, 2009, at 01:30 PM by David A. Mellis -
Deleted lines 11-15:

Warning:

The parameter for delay is an unsigned long. When using an integer constant larger than about 32767 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL); Similarly, casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

September 26, 2008, at 03:34 PM by Paul Badger -
Changed lines 38-39 from:

While it is easy to create a blinking LED with the delay() function, and many sketches use short delays for such tasks as switch debouncing, the use delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay() function, and many sketches use short delays for such tasks as switch debouncing, the use of delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

September 25, 2008, at 11:29 PM by David A. Mellis -
Changed lines 4-5 from:

Pauses the program for the amount of time (in miliseconds) specified as parameter.

to:

Pauses the program for the amount of time (in miliseconds) specified as parameter. (There are 1000 milliseconds in a second.)

Changed lines 7-8 from:

unsigned long ms - the number of milliseconds to pause (There are 1000 milliseconds in a second.)

to:

ms (unsigned long): the number of milliseconds to pause

Changed lines 19-20 from:

The sketch below configures pin number 13 to work as an output pin. It sets the pin to HIGH, waits for 1000 miliseconds (1 second), sets it back to LOW and waits for 1000 miliseconds.

 [@
to:

[@

Changed lines 45-48 from:
to:
September 21, 2008, at 04:16 PM by Paul Badger -
Changed line 38 from:

Caveats

to:

Caveat

September 21, 2008, at 04:16 PM by Paul Badger -
Changed lines 41-43 from:

Certain things do go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values are maintained, and interrupts will work as they should.

to:

Certain things do go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values and pin states are maintained, and interrupts will work as they should.

September 21, 2008, at 04:14 PM by Paul Badger -
Changed lines 39-40 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay() function, and many sketches use short delays for such tasks as switch debouncing, the use delay() in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay() for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

September 21, 2008, at 04:08 PM by Paul Badger -
Changed lines 41-45 from:

Certain things can go on while the delay() function is controlling the Atmega chip, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values are maintained, and interrupts will work as they should.

, because separate hardware on the Atmega chip allow

to:

Certain things do go on while the delay() function is controlling the Atmega chip however, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values are maintained, and interrupts will work as they should.

September 21, 2008, at 03:56 PM by Paul Badger -
Changed lines 41-43 from:

That being said, the delay function does not disable interrupts, so certain things can go on while the delay() function is controlling the Atmega chip. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values are maintained, and interrupts will work as they should.

to:

Certain things can go on while the delay() function is controlling the Atmega chip, because the delay function does not disable interrupts. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values are maintained, and interrupts will work as they should.

September 21, 2008, at 03:54 PM by Paul Badger -
Added lines 41-45:

That being said, the delay function does not disable interrupts, so certain things can go on while the delay() function is controlling the Atmega chip. Serial communication that appears at the RX pin is recorded, PWM (analogWrite) values are maintained, and interrupts will work as they should.

, because separate hardware on the Atmega chip allow

September 21, 2008, at 03:45 PM by Paul Badger -
Added lines 18-19:

The sketch below configures pin number 13 to work as an output pin. It sets the pin to HIGH, waits for 1000 miliseconds (1 second), sets it back to LOW and waits for 1000 miliseconds.

Changed lines 37-38 from:

configures pin number 13 to work as an output pin. It sets the pin to HIGH, waits for 1000 miliseconds (1 second), sets it back to LOW and waits for 1000 miliseconds.

to:
September 21, 2008, at 03:43 PM by Paul Badger -
Changed lines 38-39 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of 'delay' for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

September 21, 2008, at 03:42 PM by Paul Badger -
Changed lines 38-39 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of 'delay' for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

September 21, 2008, at 03:41 PM by Paul Badger -
Changed lines 38-39 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

September 21, 2008, at 03:40 PM by Paul Badger -
Changed lines 38-39 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds, unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds unless the Arduino sketch is very simple.

September 21, 2008, at 04:59 AM by Paul Badger -
Changed lines 38-39 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debugging, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds, unless the Arduino sketch is very simple.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debouncing, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations, or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds, unless the Arduino sketch is very simple.

September 21, 2008, at 04:58 AM by Paul Badger -
Changed lines 38-40 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debugging, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debugging, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below. More knowledgeable programmers usually avoid the use of delay for timing of events longer than 10's of milliseconds, unless the Arduino sketch is very simple.

September 21, 2008, at 04:56 AM by Paul Badger -
Added line 44:
  • BlinkWithoutDelay
September 21, 2008, at 04:55 AM by Paul Badger -
Changed lines 38-40 from:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debugging, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations or pin manipulation go on during delay so in effect, it brings most activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below.

to:

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debugging, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations or pin manipulation can go on during the delay function, so in effect, it brings most other activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below.

September 21, 2008, at 04:53 AM by Paul Badger -
Changed lines 4-5 from:

Pauses your program for the amount of time (in miliseconds) specified as parameter.

to:

Pauses the program for the amount of time (in miliseconds) specified as parameter.

Changed lines 7-8 from:

unsigned long ms - the number of milliseconds to pause (there are 1000 milliseconds in a second)

to:

unsigned long ms - the number of milliseconds to pause (There are 1000 milliseconds in a second.)

Changed lines 37-40 from:
to:

Caveats

While it is easy to create a blinking LED with the delay function, and many sketches use short delays for such tasks as switch debugging, the use of delay in a sketch has significant drawbacks. No other reading of sensors, mathematical calculations or pin manipulation go on during delay so in effect, it brings most activity to a halt. For alternative approaches to controlling timing see the millis() function and the sketch sited below.

February 18, 2008, at 06:45 AM by Paul Badger -
Changed lines 15-16 from:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

to:

e.g. delay(60000UL); Similarly, casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

February 18, 2008, at 06:44 AM by Paul Badger -
Changed lines 15-16 from:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

to:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

February 18, 2008, at 06:44 AM by Paul Badger -
Changed lines 15-16 from:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. 'delay((unsigned long)tdelay * 100UL); '

to:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

February 18, 2008, at 06:43 AM by Paul Badger -
Changed lines 15-16 from:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

to:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. 'delay((unsigned long)tdelay * 100UL); '

February 18, 2008, at 06:43 AM by Paul Badger -
Changed lines 15-16 from:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

to:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

February 18, 2008, at 06:42 AM by Paul Badger -
Changed line 14 from:

When using a number larger than about 32767 as a parameter for delay, append an "UL" suffix to the end.

to:

When using an integer constant larger than about 32767 as a parameter for delay, append an "UL" suffix to the end.

February 18, 2008, at 06:42 AM by Paul Badger -
Changed lines 14-16 from:

When using a number larger than about 32000 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay);

to:

When using a number larger than about 32767 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay * 100UL);

February 18, 2008, at 06:41 AM by Paul Badger -
Changed lines 15-16 from:

e.g. delay(60000UL);. Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay).

to:

e.g. delay(60000UL); Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay);

February 18, 2008, at 06:40 AM by Paul Badger -
Changed lines 14-15 from:

When using a number larger than about 32000 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL). Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay).

to:

When using a number larger than about 32000 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL);. Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay).

February 18, 2008, at 06:39 AM by Paul Badger -
Changed line 38 from:
to:
Changed line 41 from:
to:
February 18, 2008, at 06:38 AM by Paul Badger -
Changed lines 14-15 from:

When using a number larger than about 32000 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL). Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay)

to:

When using a number larger than about 32000 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL). Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay).

Added line 38:
February 18, 2008, at 06:36 AM by Paul Badger -
Changed lines 14-15 from:

When using a number larger than about 32000 as a parameter for delay, append an UL suffix to the end. e.g. delay(60000UL)

to:

When using a number larger than about 32000 as a parameter for delay, append an "UL" suffix to the end. e.g. delay(60000UL). Similarly casting variables to unsigned longs will insure that they are handled correctly by the compiler. e.g. delay((unsigned long)tdelay)

February 18, 2008, at 06:34 AM by Paul Badger -
Changed lines 13-14 from:

When using numbers larger than about 32000 as parameters, append an UL suffix to the end. e.g. delay(60000UL)

to:

The parameter for delay is an unsigned long. When using a number larger than about 32000 as a parameter for delay, append an UL suffix to the end. e.g. delay(60000UL)

February 18, 2008, at 06:33 AM by Paul Badger -
Changed lines 12-13 from:

Warning: When using numbers larger than about 32000 as parameters, append an UL suffix to the end. e.g. delay(60000UL)

to:

Warning:

When using numbers larger than about 32000 as parameters, append an UL suffix to the end. e.g. delay(60000UL)

February 18, 2008, at 06:33 AM by Paul Badger -
Changed lines 7-8 from:

ms: the number of milliseconds to pause (there are 1000 milliseconds in a second)

to:

unsigned long ms - the number of milliseconds to pause (there are 1000 milliseconds in a second)

Added lines 12-13:

Warning: When using numbers larger than about 32000 as parameters, append an UL suffix to the end. e.g. delay(60000UL)

January 21, 2008, at 05:54 PM by David A. Mellis -
Deleted lines 36-38:
January 13, 2006, at 12:47 AM by 82.186.237.10 -
Changed line 9 from:

This function returns

to:

Returns

Added lines 36-39:
December 29, 2005, at 03:00 PM by 82.186.237.10 -
Changed lines 1-9 from:

delay

What it does

It pauses your program for the amount of time (in miliseconds) specified as parameter.

What parametres does it take

It takes one integer value as parameter. This value represents miliseconds (there are 1000 milliseconds in a second).

to:

delay(ms)

Description

Pauses your program for the amount of time (in miliseconds) specified as parameter.

Parameters

ms: the number of milliseconds to pause (there are 1000 milliseconds in a second)

Changed lines 34-35 from:
to:
December 16, 2005, at 10:16 PM by 85.18.81.162 -
Changed lines 8-9 from:

It takes one integer value as parameter. This value represents miliseconds.

to:

It takes one integer value as parameter. This value represents miliseconds (there are 1000 milliseconds in a second).

December 03, 2005, at 08:30 PM by 213.140.6.103 -
Added line 37:
December 03, 2005, at 08:28 PM by 213.140.6.103 -
Added lines 1-36:

delay

What it does

It pauses your program for the amount of time (in miliseconds) specified as parameter.

What parametres does it take

It takes one integer value as parameter. This value represents miliseconds.

This function returns

nothing

Example

 
int ledPin = 13;                 // LED connected to digital pin 13

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  delay(1000);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1000);                  // waits for a second
}

configures pin number 13 to work as an output pin. It sets the pin to HIGH, waits for 1000 miliseconds (1 second), sets it back to LOW and waits for 1000 miliseconds.

See also

Share