int count=0;
int status;
void setup() {
// put your setup code here, to run once:
pinMode(7, OUTPUT);
pinMode(8, INPUT);
status=digitalRead(8);
}
void loop() {
// put your main code here, to run repeatedly:
if(status!=digitalRead(8)){
if(status == LOW)count++;
status=!status;
// printf(status);
}
if(count%2==0){
digitalWrite(7, HIGH);
}
else{
digitalWrite(7, LOW);
}
delay(50);
}