user8162: Is it possible to let a led blink, for example 5 times with Arduino?
Should I use a For loop?
Something like this works within the setup loop, but it will run continuesly in the void loop. So my led keeps blinking.
  for (int i = 0; i <= 5; i++) {
    led HIGH
    delay(500);
    led LOW
    delay(500);
  }

Also the blink sequence has to be triggered, and have a reset after it is done.
The complete code is to big to share, but it runs a bit like the following:
There is a "bankValue", it is filled by a user, and counts back to zero.
If it's zero, then blink 5 times.
After the blink, the leds are off.
The sketch is waiting for a new user, who will fill the bankValue again and the ledblink should again be initiated.

user10285: 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 == 0 && ! 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.

8162: <p>Is it possible to let a led blink, for example 5 times with Arduino?
Should I use a For loop?</p>
<p>Something like this works within the setup loop, but it will run continuesly in the void loop. So my led keeps blinking.</p>
<pre><code>  for (int i = 0; i &lt;= 5; i++) {
    led HIGH
    delay(500);
    led LOW
    delay(500);
  }
</code></pre>
<p>Also the blink sequence has to be triggered, and have a reset after it is done.
The complete code is to big to share, but it runs a bit like the following:</p>
<p>There is a &quot;bankValue&quot;, it is filled by a user, and counts back to zero.
If it's zero, then blink 5 times.
After the blink, the leds are off.
The sketch is waiting for a new user, who will fill the bankValue again and the ledblink should again be initiated.</p>
 10285: <p>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:</p>
<p>There should be a part in the void loop method where you detect that the &quot;bankValue&quot; is down to zero. Like:</p>
<pre><code>if (bankValue == 0) 
{ 

}
</code></pre>
<p>First you must be sure that, the for loop is called within this block.</p>
<pre><code>if (bankValue == 0) 
{ 
  // I corrected the loop to run exact 5 times (&lt;= -&gt; &lt;)
  for (int i = 0; i &lt; 5; i++) 
  {
    led HIGH
    delay(500);
    led LOW
    delay(500);
  }
}
</code></pre>
<p>Then you need a flag <code>int blinkingDone = 0;</code>  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 &quot;fills&quot; the bankValue again.</p>
<p>Then you could use it as a guard to enter the for loop. Like:</p>
<pre><code>int blinkingDone = 0;
int bankValue = 0;

..... somewhere else

if ( coin inserted or so )
{
  // fill bankValue
  blinkingDone = 0;
} 

..... somewhere else 

if (bankValue == 0 &amp;&amp; ! blinkingDone) 
{ 
  // I corrected the loop to run exact 5 times (&lt;= -&gt; &lt;)
  for (int i = 0; i &lt; 5; i++) 
  {
    // led HIGH
    delay(500);
    // led LOW
    delay(500);
  }
  blinkingDone = 1;
}
</code></pre>
<p>There are potential better ways to do it. But I don't know your code. So this is the simplest way I can imagine.</p>
