Arduino Airconditioner controller

G'day everyone

I'm new to arduino and I'm trying to get my head around the If and Else commands. Im looking at building an airconditioner controller for my house. The aircon has a number of features. A master on/off, a water pump for "Cool Mode" and a high/low mode. I want to use an arduino to turn the system on at about 30 degrees celcius (I have this part under control) but before it turns the fan on I'd like the water pump to run for about 30 seconds. I thought about putting this in a loop with a delay between the fan and pump turning on, but this will only mean that the delay cycle runs all the time turning the fan and pump on and off all day. How can I overcome this?

Thanks in advance

Rothy

My chrystall ball is away for being polished so I can't read Your code.

Pseudo code:

if(temp >= 30)
{  
  turn pump on;
  timer = millis();
}
if(pump_is_on and millis() - timer > 30000) // 30 seconds
  turn fan on;

Attache the entire code.
That piece of code will not work. When temp is > 30 You do timer = millis();. In the next if-statement millis() - timer > 30000 will never happend.

@Railroader:
did you miss Pseudo code?
Lets see your version.

Better?

if(! timing and temp >= 30)
{  
  turn pump on;
  timer = millis();
  timing = true; 
}
if(pump_is_on and millis() - timer > 30000) // 30 seconds
  turn fan on;

Sounds like a good case for a very simple state machine.