Its really heavy to give a correct answer, if you don't show us the context where the for loop is used. But I'll try:
There should be a part in the void loop method where you detect that the "bankValue" is down to zero. Like:
if (bankValue == 0)
{
}
First you must be sure that, the for loop is called within this block.
if (bankValue == 0)
{
// I corrected the loop to run exact 5 times (<= -> <)
for (int i = 0; i < 5; i++)
{
led HIGH
delay(500);
led LOW
delay(500);
}
}
Then you need a flag int blinkingDone = 0; to indicate that the for loop has executed. This flag must be initialize with a falsy value, set to trueish after the loop is done and reset if the user "fills" the bankValue again.
Then you could use it as a guard to enter the for loop. Like:
int blinkingDone = 0;
int bankValue = 0;
..... somewhere else
if ( coin inserted or so )
{
// fill bankValue
blinkingDone = 0;
}
..... somewhere else
if (bankValue == zero0 && ! blinkingDone)
{
// I corrected the loop to run exact 5 times (<= -> <)
for (int i = 0; i < 5; i++)
{
// led HIGH
delay(500);
// led LOW
delay(500);
}
blinkingDone = 1;
}
There are potential better ways to do it. But I don't know your code. So this is the simplest way I can imagine.