When the led is switched on, you set a timer.
In the loop(), you check regularly if the timer has expired (your 5 seconds) and, if so, switch the led off.
When the led is switched on, you set a timer.
In the loop(), you check regularly if the timer has expired (your 5 seconds) and, if so, switch the led off.