
int button = 8;     
int led = 2;
int state = false;

void setup() {
  pinMode(led, OUTPUT);      
  pinMode(button, INPUT);     
}

void loop(){

  if (digitalRead(button) == HIGH) { 
    state=!state;
    digitalWrite(led, state); 
    while (digitalRead(button) == HIGH) {
      delay(20);  
    }
  }
}
