simple timer

hi every one could any one help here im making a ventilation fan for my propogator i want it to blow fresh air in for 1 min every hour approx. i have been looking at tutorials and all over the net but more confused now on using millis could any one point me in the correct direction cheers for any help

I just Googled "Arduino fan control" and got 354,000 hits. Surely one will help. As a start, try:

http://medialappi.net/lab/tutorials/controlling-12-v-fan-with-arduino-digital-pin/

sorry to mention im using a relay

const int MotorPin = 8; // Arduino pin going to transistor

void setup() { pinMode(MotorPin, OUTPUT}; }

void loop() { digitalWrite(MotorPin, HIGH); // Turn the motor on delay(60000); // Wait 60 seconds digitalWrite(MotorPin, LOW); // Turn motor off delay(21600000UL - 60000UL); // Wait 5 hours and 59 minutes }

need to change this to 59 minutes

delay(21600000UL - 60000UL); // Wait 5 hours and 59 minutes

would this one work ??

void setup() {
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH); // set the LED on
for (int x=0; x < 1000; x++) { // Wait for 20 second
delay(20);
}
digitalWrite(13, LOW); // set the LED on
for (int x=0; x < 1000; x++) { // Wait for 1 hour
delay(3600);
}
}

const unsigned int SEC = 1000;
const unsigned long MIN = 60*SEC;
const unsigned long HOUR = 60*MIN;
const int fanPin = 13;
unsigned long mark;
enum {fanOff, fanOn} fanState;

void setup(){
  pinMode(fanPin, OUTPUT);
  mark = millis();//set timestamp
}//setup()

void loop(){
  if(mark<=millis()){//timestamp reached, do some action
    switch(fanState){
      case fanOff: 
        mark += MIN;//create new timestamp
        digitalWrite(fanPin, 1);//turn fan on
        fanState = fanOn;//change state
        break;
      case fanOn: 
        mark += HOUR-MIN;//create new timestamp
        digitalWrite(fanPin, 0);//turn fan off
        fanState = fanOff;//change state
    }//switch(fanState)
  }//if(timestamp reached)
}//loop()

IS THIS THE BEST WAY TO MAKE IT WORK

void setup() {
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH); // set the LED on
for (int x=0; x < 1000; x++) { // Wait for 20 second
delay(20);
}
digitalWrite(13, LOW); // set the LED on
for (int x=0; x < 1000; x++) { // Wait for 1 hour
delay(3600);
}
}

markthespark: IS THIS THE BEST WAY TO MAKE IT WORK

I do not think code utilizing delay() can be considered "best"

IS THIS THE BEST WAY TO MAKE IT WORK

If that is all you want the code to do then it looks like it will work. Whether it is the best way is another question. If you ever want to update the program, perhaps to add a manual override, then it is not the best way to do it, but that is not part of your current requirements.