Delay function in Embedded programming

What is Delay function?

As the name suggest delay function is used to delay the program or we can say sleep for sometimes. You can understand its use by knowing where it is used.


Let us take a small example like blinking led or blinky led. Here we will use the use delay function to give some delay between led turn on and turn off. Like wise it is used in many areas of embedded programming.

How to program??

There are many ways to give delay function in c or cpp by using for, while.

For Loop

for(int i = 0; i<1000; i++) {
    for(int j = 0; j<100; j++) {

While Loop


Do while loop

do {

-> Let Us Embed <-