delay ( )

delay()

delay() tells the Arduino to wait for a certain amount of time. While waiting during a delay, Arduino doesn't do anything new. After waiting, it will follow the instruction on the next line of code.

Inputs

It takes an input, which is an int. This int tells the Arduino how long to wait for. It's a number of milliseconds. 1000 milliseconds is the same as 1 second. So delay(1000) will wait for 1 second.

Example

// turn the LED on awesome.LED.turnOn(); // do nothing for 1000 milliseconds // or 1 second delay(1000); // turn the LED off awesome.LED.turnOff();

Tips

delay() is lets you separate instructions by a certain amount of time. For example, you could turn the LED on, use delay() to wait for one second, and then turn it off. This is helpful if you want to make the LED blink, or use the buzzer to play a song.

x

Goodbye and thanks for all the fish,

Thanks for helping us Kickstart Awesome Shield and learning with us. Sadly, turning Awesome Shield into a sustainable business didn’t work out and so we’re in the process of officially shutting down the company.

Read our full letter.

If you have an Awesome Shield you can keep using it and the learning platform.


Close Message