const int buttonPin = 2;
const int ledPin =13;
int buttonState =0,loadState =0;
void setup(){
pinMode(ledPin,OUTPUT);
pinMode(buttonPin,INPUT);
delay(10);
// put your setup code here, to run once:
}
void loop() {
if (buttonState == 0 && digitalRead(buttonPin) == HIGH){
buttonState = 1;
delay(50);
loadState =!loadState;
}
if (buttonState == 1 && digitalRead(buttonPin) == LOW){
buttonState = 0;
delay(50);
}
if(loadState == HIGH){
digitalWrite(ledPin,HIGH);
}
else{
digitalWrite(ledPin, LOW);
}
}// put your main code here, to run repeatedly: