Reference.Delay History

Hide minor edits - Show changes to output

August 24, 2012, at 11:58 PM by Scott Fitzgerald -
Changed line 17 from:
[@
to:
(:source lang=arduino:)
Changed lines 32-34 from:
@]

to:
(:sourceend:)

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:
* [[micros]]()
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|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|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 [[Constants|HIGH]], waits for 1000 miliseconds (1 second), sets it back to [[Constants|LOW]] and waits for 1000 miliseconds.
[@
to:
[@
Changed lines 45-48 from:
* [[millis]]
* [[http://arduino.cc/en/Tutorial/BlinkWithoutDelay|BlinkWithoutDelay]]
* [[delayMicroseconds]]
* [[IntegerConstants |integer constants]]
to:
* [[millis]]()
* [[delayMicroseconds]]()
* [[Tutorial/BlinkWithoutDelay| Blink Without Delay]] example
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 [[AttachInterrupt|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 [[AttachInterrupt|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|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 [[AttachInterrupt|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 [[Constants|HIGH]], waits for 1000 miliseconds (1 second), sets it back to [[Constants|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 [[Constants|HIGH]], waits for 1000 miliseconds (1 second), sets it back to [[Constants|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:
* [[http://arduino.cc/en/Tutorial/BlinkWithoutDelay|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:
* [[constans |integer constants]]
to:
Changed line 41 from:
to:
* [[IntegerConstants |integer constants]]
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:
* [[constans |integer constants]]
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:


[[HomePage | Reference Home]]
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:



[[HomePage | Reference Home]]
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:
* [[digitalWrite]]
* [[pinMode]]
to:
* [[millis]]
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:
* [[delayMicroseconds]]
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 [[Constants|HIGH]], waits for 1000 miliseconds (1 second), sets it back to [[Constants|LOW]] and waits for 1000 miliseconds.


!!!!See also
* [[digitalWrite]]
* [[pinMode]]

Share