Go Down

Topic: Start up delay (Read 475 times) previous topic - next topic

kengr1

How do I get a delay at the start of the loop? that only happens once. ie I power up the arduino. It waits five seconds before running through loop(). But the five second delay doesnt happen each time it goes through the loop?

Code: [Select]
loop()
{
delay(5000);
}


Gives a five second delay every time the loop is executed, i just want to have it delay just once, at the beginning.

pluggy

Easy, you just put the delay in the setup() part of the sketch.
http://pluggy.is-a-geek.com/index.html

retrolefty


How do I get a delay at the start of the loop? that only happens once. ie I power up the arduino. It waits five seconds before running through loop(). But the five second delay doesnt happen each time it goes through the loop?

Code: [Select]
loop()
{
delay(5000);
}


Gives a five second delay every time the loop is executed, i just want to have it delay just once, at the beginning.


Simply put the 5 second delay command as the last statement of your void setup() section.

Lefty

Go Up