PaulS:
You've got a watch (millis()) and a pad of paper (the variables you define in the sketch). Now, define how YOU would approach the problem.
Once you know how to perform the actions that you want the Arduino to perform, making the Arduino do it is trivial.
jwatte:
You have three states, right?
- waiting for trigger
- triggered, but waiting for a certain point in time
- triggered, and after the certain point in time
In states 1 and 2, you want your LED to be off.
In state 3, you want your LED to be on.
You could for example, use one variable for what state you're in, and switch on that state in loop().
In state 1, check the trigger, and if it's on, switch to state 2.
Then you could use another variable for when the light should turn on. Set that variable as you switch from state 1 to state 2, and check the time in the loop function for state 2 for whether it's time to switch to state 3.
Turn the LED on when switching to state 3.
sorry,,i didn't follow my thread for a while
actually i've made a sketch for this project
but i'm not using millis() function,,coz still confuse how to apply millis on my project 
i took another way
here is the code :
int pirPin = 1;
int ledPin =12;
boolean hold = false;
long timer;
void setup(){
pinMode (pirPin, INPUT);
pinMode (ledPin, OUTPUT);
Serial.begin(9600);
}
void loop(){
int pirState = digitalRead(pirPin);
if (pirState == HIGH){
digitalWrite(ledPin, HIGH);
hold = true;
timer = 0;
}
else if (hold == true){
timer = timer + 1;
Serial.println(timer);
if (timer > 3000){
digitalWrite(ledPin, LOW);
timer = 0;
hold = false;
}
}
else {
digitalWrite(ledPin, LOW);
}
}
i'm using counter code in variable timer (timer = timer + 1)
i set 3000 counter for timer
3000 counter doesn't mean 3000ms..when i observed, 3000 counter = 18 sec
when i set additional input & output, the system works parallel well
but the counter orientation is different...when i observed, 3000 counter = 20 sec
why ?
and also i have to put Serial.println on my code
if it did'nt, the timer won't counting