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.
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.
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.