Can you see what's wrong with the code?
For one thing, it is attached even though it is small enough to have been posted in a code box, like this:
int triggerPin=2;
int flashLed=3;
int irLed=5;
unsigned long previousMillis=0;
int triggerState=0;
int lastTriggerState=0;
const long interval=1000;
void setup(){
Serial.begin(9600);
pinMode(flashLed,OUTPUT);
pinMode(irLed,OUTPUT);
pinMode(triggerPin,INPUT);
}
void loop(){
unsigned long currentMillis=millis();
triggerState=digitalRead(triggerPin);
if(triggerState!=lastTriggerState){
if(triggerState==HIGH){
digitalWrite(flashLed,HIGH);
digitalWrite(irLed,HIGH);
}
}
if(currentMillis-previousMillis>=interval){
digitalWrite(flashLed,LOW);
digitalWrite(irLed,LOW);
previousMillis=currentMillis;
}
Serial.println(currentMillis);
lastTriggerState=triggerState;
}
if(triggerState!=lastTriggerState){
if(triggerState==HIGH){
digitalWrite(flashLed,HIGH);
digitalWrite(irLed,HIGH);
}
}
Isn't the time that you turned the pins on the event time of interest, not the time loop() started?
johnwasser posted before I did, but his event time variable names make no sense now. Do as he suggests, but use better names. There is NOTHING magic about millis in the name, so dump it if it makes it easier to understand the code. now and pinOneTime, perhaps.