Controlling LED with multiple functions

I essentially have some code in my forever loop that controls the state of some LEDs based off external conditions. I want to make it such that when I push a button, it runs a function that powers all the LEDs on, then powers them off, then basically hands off the LED control to the original code. The problem I'm having is when I push the button, the LEDs turn on, then off, but they stay off and don't return to their previous states. Any help is appreciated.

Which code?
It is pointless to discuss code problem without the code itself.

please describe what this "then" should be.
then ... after the release of the button
then ... after 42 seconds
then ... after another button was pressed

Most of the time a program flow or a timing diagram tells more than 1000 words.
You can post your diagram and your current code to the forum.

When a button is pressed, you must set a flag to indicate a button was pressed. Testing the flag will let your program start the reaction to the button. When the reaction to the button press is complete, clear the flag so the reaction does not repeat.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.