How to make a led blink 5 times and stop?

I'm a newbie and trying to find a way to make a light blink a set amount of time and then stop? So far all I can find is making a light blink using a loop.

Thank you

Show use what you have tried.

Take a look at some example of control statements.
Such as IF or FOR

Thank you. I will give it a go and post what I came up with.

so, it is a good opportunity to learn about functions:

try this:

int ledPin = 13;
int blinkTime = 500;

void setup()
{
  pinMode(ledPin, OUTPUT);
  blinkyBlinky(5, blinkTime); // 5 is number of blinks, blinkTime is the milliseconds in each state from above: int blinkTime = 500;
}

void loop()
{
  //
}

void blinkyBlinky(int repeats, int time)
{
  for (int i = 0; i < repeats; i++)
  {
    digitalWrite(ledPin, HIGH);
    delay(time);
    digitalWrite(ledPin, LOW);
    delay(time);
  }
}

BulldogLowel is on the right line.
I would suggest a slight modification.

int ledPin = 13;
int blinkTime = 500;
bool eyesStinging=true;


void setup()
{
  pinMode(ledPin, OUTPUT);
if(eyesStinging)                         //Only blink if it's absolutely necessary
  blinkyBlinky(5, blinkTime); // 5 is number of blinks, blinkTime is the milliseconds in each state from above: int blinkTime = 500;
}

void loop()
{


  //
}

void blinkyBlinky(int repeats, int time)
{
  for (int i = 0; i < repeats; i++)
  {
    digitalWrite(ledPin, HIGH);
    delay(time);
    digitalWrite(ledPin, LOW);
    delay(time);
  }
}

I have tried this program just from the example of the BLINK program just made a little change.

I have tried this in #inbulit-led and #external-led also. You can see this code below and while

testing with external you should check the pins and declare them properly

blink5.ino (474 Bytes)

ganapati97:
I have tried this program just from the example of the BLINK program just made a little change.

I have tried this in #inbulit-led and #external-led also. You can see this code below and while

testing with external you should check the pins and declare them properly