time=millis()

Necesito ponerle a mi time=millis que apage luces cuando pase 5 minutos. yo puse if (time>5000){ digitalWrite(OutPinI, LOW); digitalWrite(OutPin, LOW); } else {digitalWrite(OutPinI, HIGH); digitalWrite(OutPin, LOW); } esta bien esto?

millis() gives milliseconds.

5000 is 5 seconds, not 5 minutes.

5 minutes is 5*1000*60=300000

sisi perdon. pero me dijo que le tengo que sumar la diferencia de lo que tarda oque vuelva el time=millis a 0 y eso es lo que no se hacer.

millis() gets the time.

You need to record the time when you want the 5 minutes to start, and then check the time in loop

``````unsigned long setTime;

void setup() {

setTime=millis()+300000; //5 minutes
//and everything else you need
}

void loop() {
if (millis() > setTime)
//do stuff
} else {
//not time yet
}

}
``````

setTime=millis()+300000UL; //5 minutes << add UL here

Is the “stuff” one time, or will it keep repeating?

``````void loop() {
if (millis() > setTime)
{
// set up for next time if repeating
setTime = setTime + 3000000UL;
//do stuff
}
else
{
//not time yet, do other things (or, don't!)
}
} // end loop
``````