A simple little cheat way is to wait for button release, then wait for button press at the start of your code:
void loop()
{
digitalWrite(ledPin,HIGH); // Set the idle state
while(digitalRead(buttonPin)==HIGH); // Wait for a release, if it is pressed.
while(digitalRead(buttonPin)==LOW); // Wait for button to be pressed.
for (int i=0; i <= numberOfPulses; i++)
{
// set the LED on
delay(10);
digitalWrite(ledPin, LOW);
delay(10);
digitalWrite(ledPin, HIGH);
}
}
Of course, this doesn't fit well with a state machine if you ever want to expand your code to do other things. If this is all it will do then this method is fine.