Millis() misunderstanding

I've been trying to wrap my head around how millis() works..

scenario:

output from an AND gate going into input 3 on my arduino board

after arduino senses this high value for 60+ seconds

print (blah)

I don't understand how express this with millis()

unsigned long time;

time = millis();

if(digitalRead(andIn) == HIGH >= 60 seconds) {

Serial.println("Blah");

}

it keeps incrementing since the code is executed? so you would need to compare the time since the andIn goes high against millis()?

:-[

You need to capture the time that the pin when high and check if 60 seconds has elapses since then. You don't say what you want to happen after that but lets assume you only want the print statement to appear once only until the pin goes low again.

To do this you can store the millis value if the pin his high – but only if the pin was not already high.

 unsigned long startTime;
 boolean hasPrinted;

if(digitalRead(andIn) == HIGH){
   if(startTime == 0) 
      startTime = millis();
   else if (millis() >= startTime  + 60000  &&  hasPrinted == false){
      Serial.println("Blah");
      hasPrinted = true;
   }
}
else{
   // pin has gone low
  startTime = 0;
  hasPrinted = false;
}

The code isn't tested but I hope it give you some ideas on how to proceed

thats pretty much it

mem to the rescue again!

all i wanted was to print that statement, i'm using python to read the serial port and whenever Blah is seen it triggers an email alert, has to do with those PIR sensors you helped out with a few weeks back

thanks again