int ledpin = 8;
int switchpin = 7;
boolean ledvalue = 1;
boolean switchvalue =1;
void setup() {
// put your setup code here, to run once:
pinMode(switchpin, INPUT);
pinMode(ledpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(switchpin)==LOW){
delay(20);
if(digitalRead(switchpin)==LOW){
if(switchvalue){
digitalWrite(ledpin,ledvalue);
switchvalue=0;
ledvalue=!ledvalue;
}
}
}
else{
switchvalue=1;
}
}