I am trying to create a timer that will keep a fan on and leave it on until a 1 minute period has passed, then turn it off.
Once the fan has turn on ,it must stay on for a fixed time of 1 minute before shutting off
I just posted the timer portion, as the full sketch is to large.
The code below works but, while the fan is on and the timer is counting, nothing else is responsive.
What am i doing wrong?
Any help would be appreciated
Thanks
Joe
//*************TIMER CHECK**********************************
//If conditions are true turn on the A3 fan until 1 minute has past then shutoff of A3 are true...
if(rffan == HIGH) // status for temperature sensor 2 (temp2)
{
//record start time...
start_time = millis();
Serial.println("start_time");
Serial.println(start_time);
//turn on A3 fan, turn normal temp led off and high temp led on
// digitalWrite(A3, HIGH); // this is the temp2 fan
digitalWrite(A2,LOW); // BLUE LED off- NORMAL temp
digitalWrite(9,HIGH); // HIGH TEMP LED
//Continuosly check for finish time...
do
{
current_time = millis();
elapsed_time = current_time - start_time;
Serial.println("counting");
Serial.println(elapsed_time);
}
while(elapsed_time < 60000); // (1min) * (60s/min) * (1000ms/s)
}
//turn OFF A3 fan if the count has been met
if (elapsed_time > 60000)
{
digitalWrite(A3, LOW); // Turn off A3 temp2 fan
}
Serial.println("time complete");
Serial.println(elapsed_time);
// ===========end ===TIMER=================================