int status= 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(2, OUTPUT);
pinMode(22, OUTPUT);
pinMode(13, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(13)==HIGH) {
status++;
delay (100);
}
if(status==1){
digitalWrite(2, HIGH);
digitalWrite(22, HIGH);
}
else if (status==2){
status=0;
}
else {
digitalWrite(2, LOW);
digitalWrite(22, LOW);
}
}