enebling timer

hello

im trying to start digital output on and off by sequence, and there will be a time delay in between, thats easy to do, but there is a condition for the sequence to start, digital inputs must be enebled, and when these inputs are off the sequence must stop and do other things, for example printing alarm on a LCD, her is the sequence:

if (DI1 is HIGH and DI2 is HIGH) {
DO1 is HIGH
delay (time)
DO2 is HIGH
delay(time)

else {
DO1 is LOW
DO2 is LOW
}

the problem is i want the sequence to stop directly if one of the inputs is off, is there away to use millis() to set a timer being trigred by action, and then start another timer, not only from the starting of arduino controller.

i tried to use some Libraries like simpletimer and timealarm, but the problem is that the timer is triggered from the starting of arduino controller, i need to use the timer at the logic of the program, any help will be appreciated.

thanks

Yes, you can use millis() for that, and is the better way to "make something to wait" in Arduino. You can follow the "BlinkWithoutDelay" example form you IDE or from this page: