Blink LED When Button Pushed

Use a button to control when the LED blinks.

picture of board with parts schematic

/* 
  blink_when_button_pushed
  
*/

int ledPin = 11;
int inPin = 2;
int val;

void setup() {
  pinMode(inPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // Read the value of the button
  val = digitalRead(inPin);
  
  // If the button has been pushed, flash the led
  if (val == HIGH) {
     digitalWrite(ledPin, HIGH);
     delay(250);
     digitalWrite(ledPin,LOW);
     delay(250);
  }
}