starting a loop with button press

Hi I want to program an led to flash on and off 20 times. The on for 100ms and the off for 100ms.
I have made a loop using there count function which works fine on its own but i would like to start that loop with a button press.
Then once the loop is completed the count to go back to 0 to be ready for me to press the button the next time.
I have tried few things with no luck.

Regards James
Here is my code:

#include <Bounce2.h>

int buttonPin = 5;
int ledPin = 13;
int delayPeriod = 100;
int count = 0;

Bounce bouncer = Bounce (buttonPin, 5);

void setup()
{
pinMode (buttonPin, INPUT);
digitalWrite (buttonPin, HIGH);
pinMode (ledPin, OUTPUT);
}

void loop()
{
if (bouncer.update() && bouncer.read() == LOW)
{
(count <= 20);
digitalWrite (ledPin, HIGH);
delay (delayPeriod);
digitalWrite (ledPin, LOW);
delay (delayPeriod);
count ++;
}
}

When you post code please use code tags as described in Read this before posting a programming question.

Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Just a quick glance at you code…
I have only used the Bounce2 library a couple of times, but, you aren’t attaching the button pin anywhere.
My code:

At the top of the sketch:

#include "Bounce2.h"
Bounce debouncer = Bounce();

In setup()

 pinMode(buttonPin, INPUT_PULLUP);
  // After setting up the button, setup the Bounce instance :
  debouncer.attach(buttonPin);
  debouncer.interval(100);

And, in the loop:

 // Detect the falling edge (button released).
  debouncer.update();

  // Call code if Bounce fell (transition from HIGH to LOW) :
  if ( debouncer.fell() ) {

Now, there are probably other ways to use Bouncer, but this worked for me.

Your logic in the loop() is not going to work.

void loop()
{
  if  (bouncer.update()  && bouncer.read() == LOW)
  {
    (count <= 20);
    digitalWrite (ledPin, HIGH);
    delay (delayPeriod);
    digitalWrite (ledPin, LOW);
    delay (delayPeriod);
    count ++;
  }
}

Don’t you mean ?

   if(count <= 20){

yes my logic is not going to work, I do mean

if (count <= 20) {

I have put that in and am still not getting it to got through the loop when press the button.