How to delay code execution after boot sequence?

I want my Uno R3 to wait 2 seconds between booting up and executing the following code, but I can't find a coding example for a delay placed outside a loop.

int controlPin = 3;
void setup()
{
  Serial.begin(9600);
  TCCR2A = 0x23;
  TCCR2B = 0x09;  // select clock
  OCR2A = 79;  // aiming for 25kHz
  pinMode(controlPin, OUTPUT);  // enable the PWM output (you now have a PWM signal on digital pin 3)
  OCR2B = 15;  // set the PWM duty cycle to 19%
}

void loop()
{
  OCR2B = 62;
  delay(5000);
  OCR2B = 120;
  delay(5000);
}

I'm a total newbie so I probably missed something simple, but any help will be appreciated.

Will delaying at the start of the setup function not do? Do you want to delay even before main() is called? If so, why?

fire-flare: I want my Uno R3 to wait 2 seconds between booting up and executing the following code, but I can't find a coding example for a delay placed outside a loop.

Why? You want it to wait before it boots?

How about:

void setup()
{
  delay (2000);
...

pYro_65: Will delaying at the start of the setup function not do? Do you want to delay even before main() is called? If so, why?

The code creates a 19% control signal for PWM computer fans, without the signal the fans spin at 100% Large fans, like the ones I intend to use, need a 1-2 second period of full power to build the inertia needed for continuous rotation; Otherwise it's like starting a car with a low battery and the engine never fully turns over.

I'm using a small fan to test the code which can turn over at a 1% duty cycle, and it shows that my arduino is sending the 19% signal the instant power is applied.

[quote author=Nick Gammon link=topic=155119.msg1162818#msg1162818 date=1363681066] How about:

void setup()
{
  delay (2000);
...

[/quote]

Sorry, I'm not seeing any change with that added.

I'm seeing an over 3 second delay from when reset is released:

However then it immediately goes to 80% duty cycle so you better look at your timer parameters:

[quote author=Nick Gammon link=topic=155119.msg1164222#msg1164222 date=1363755066] You better look at your timer parameters.

[/quote]

Wow, I was way off.

I found that the arduino wasn't receiving power at all due to a bad connection on my shield. The fan slowed down when the ground lines made contact.

Now the board's LED lights up and I was able to tweak the code to get the effect I need. (Last time I blindly copy/paste code without looking it over)

I also brainstormed a way to to keep the signal going: Make the loop last longer than my computer's average uptime. :D

int controlPin = 3;
void setup()
{
  Serial.begin(9600);
  TCCR2A = 0x23;
  TCCR2B = 0x09;  // select clock
  OCR2A = 79;  // aiming for 25kHz
  pinMode(controlPin, OUTPUT);  // enable the PWM output (you now have a PWM signal on digital pin 3)
}

void loop()
{
  OCR2B = 79; // set duty cycle for 100%
  delay(1300); // wait 1.3 seconds
  OCR2B = 14; // set duty cycle for 17.5%
  delay(604800000); // wait a week
}