Stopping A Loop after a period of time

Hey guys Im kinda new to arduino and have been trying to learn it to use on a rocketry project. I need to activate a output when an outside source activates an input which will then stop after a few seconds. Ive tried many different methods but none seam to work.

learn the "blink without delay" example.

If you have tried to blink without delay do following:

Switch on your output and set the previousMillis to millis()
Write an if statement according to the example, that if the actual millis() - previousMillis is larger than your intervall, switch off your output.

You will probably need to look at the state change detect tutorial too. If your external trigger is still in the "go" state when your output turns off, unless you're looking for the external trigger to switch from "no go" to "go", if it's still "go" then the output will go high again.

The demo Several Things at a Time is an extended example of BWoD and illustrates the use of millis() to manage timing without blocking. It may help with understanding the technique.

Have a look at Using millis() for timing. A beginners guide if you need more explanation.