top of page

09 Time Functions

delay()

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


Note: 1000 milliseconds = 1 second.


Programmers Note:

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.

delay(ms)


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




© 2021 Odyssey Navigator. All rights reserved.

bottom of page