while loop doesnt stop

hello - just got my arduino a couple days ago. its the Uno.

Basically i want to make a LED pulse 20 times and then stop. I just wanted to make this as my first program on my own. For some reason I cannot get the while loop, for loop or any kind of loop to stop. I am not sure if it is because i have my commands out of their proper order or what. If there is a better way to do this please let me know. Its running continuously and driving me nuts

My main question is how the heck do you make a loop that will stop and not run continously?
I tried also doing this instead of a while loop:

int led = 13; //led pin 13
void setup() {
pinMode(13, OUTPUT);
}

void loop (int x=0; x<=19; x++)
{

digitalWrite(led, HIGH);
delay(200);
digitalWrite(led, LOW);
delay(500);

}

But i get errors for reasons unknown to me.

Please help.

const int led = 13; //led pin 13
void setup()  { 
pinMode(led, OUTPUT);
\
for (int x=0; x<=19; x++)
{  
digitalWrite(led, HIGH); 
delay(200); 
digitalWrite(led, LOW); 
delay(500); 
}
}

void loop() {}

(int i = x=0; x<=19; x++) is for-loop syntax only. A routine’s parameter list is a common-separated list of variable declarations.

A routine's parameter list is a common-separated list of variable declarations.

If the function has a list of parameters, that is. The loop() function does not.

An empty list is still a list... ;)

masterofthese:
My main question is how the heck do you make a loop that will stop and not run continously?

To make things “easier” for you, the Arduino environment gives you setup, which runs once, and loop, which runs forever. However you don’t have to do anything in loop. This will do what you are trying:

const int led = 13; //led pin 13

void setup()  {
  pinMode(led, OUTPUT);

  for (int x=0; x<=19; x++)
  { 
    digitalWrite(led, HIGH);
    delay(200);
    digitalWrite(led, LOW);
    delay(500);
  }
} // end of setup

void loop () {}

This example blinks the LED 20 times, and then enters loop, which does nothing, forever.

You could make it blink 20 times in loop too, then wait for a button press to pull a pin low to start the next run thru the blink code. Or wait for a serial message to come in. Or wait some number of seconds. Or wait for an analog reading to reach some level. Or …

Thanks guys you are awesome. I can see that I bought the right microcontroller. I can see from the programs that are made here by some of you members that this forum is full of bright people, who are eager and willing to help.

Thank you Thank you