Periodic LED and on demand

Another approach is as follows...

Work things so that your "loop" executes 100 times per second, or so.

And have your "on for a bit" LED go on for 50 passes through the loop, if you want it on for 0.5 second. (You can do this with a variable you might call bCountDownToOff... set it to 50 when you turn the LED on, decrement it (subtract 1) each time you go through "loop", and turn LED off when bCountDownToOff reaches zero.