const int buttonPin=10;  //variable to define the pinnumber button is connected to
const int ledPin=13;
int buttonState;        //variable define the state of button

void setup() {
  // put your setup code here, to run once:
  pinMode(buttonPin, INPUT);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  buttonState=digitalRead(buttonPin);   //reads the state of button
  if(buttonState==LOW)                  //if button is pressed
  {
    digitalWrite(ledPin, HIGH);         //turns on the led
    delay(500);                         //engages processor in other task, such as to notice the high low difference  
    digitalWrite(ledPin, LOW);          //turns off the led
    delay(500);                         //engages processor in other task, such as to notice the high low difference
  }
  else                                  //if button is not pressed
  {
    digitalWrite(ledPin, LOW);          //turns off the led
  }
}