Button to turn blinking light on or off

Hi, im pretty new to arduino, and programming in general, and i just cant figure out this code. I am tryinng to make a code that takes imput from two buttons (pins 8(left) and 9(right), an has one led (pin 13). when the program starts the lights is turned off. if you click the left button (push and release) it starts the led blinking 5 times a second, and stops blinking when you click(push and release) the right button. so click the left one starts the blinking and clicking the right one stops it.

this is the best i could come up with, im afraid its not much

int led = 13;
const int buttonPinLeft = 9;
const int buttonPinRight = 8;
int state;

void setup()
{
  pinMode(buttonPinLeft, INPUT);
  pinMode(buttonPinRight, INPUT);
  pinMode(led, OUTPUT);
  state = 0;
}
void loop()
{
  if(state == 1)
  {
    for(int i=0; i<5; i++)
    {
      digitalWrite(led, HIGH);
      delay(200);
      digitalWrite(led, LOW);
    delay(200);
    }
  }
  if
}

any help would be greatly appreciated!

Two hints. :slight_smile: Try to figure out the rest :wink:
if (digitalRead(buttonPinLeft) == HIGH) state = 1;
if (digitalRead(buttonPinRight) == HIGH) state = 0;

before you start coding with buttons, study carefully the coding for debounce (noting that for some really perverse reason, that tutorial shows the switch connected "upside down" to the usual and recommended convention which has the button switching to ground and the internal pull-up of the Arduino enabled).