Millis to trigger LED for set time then reset

so Im trying to make an LED turn on for a set interval (1 second) when that function is called. the function will only be called if an IF statement in the main loop is true. I would then like the LED to turn back off after the 5 seconds then “reset” to allow me to call the function again if that same IF statement is true. I have been trying this for a couple days and feel like im missing something basic in my code to allow this.

any tips would be awesome.

sketch_mar27a.ino (783 Bytes)

Not much code for a few days :wink:

This cannot be your actual code.

You must know this is 'not' correct:
if (something=something)

previousMillis disappears when you leave the function.

Look at the BWD BlinkWithoutDelay example in the IDE.

.

Also a bit confusing when you say this "turn on for a set interval (1 second) " followed by "turn back off after the 5 seconds".