//milli
unsigned long pre1 =0;
unsigned long pre2 =0;
unsigned long pre3 =0;
unsigned long pre4 =0;
unsigned long timer1 =1000;
unsigned long timer2 =1000;
unsigned long timer3 =1000;
unsigned long timer4 =1000;
unsigned long current1 =0;
unsigned long current2 =0;
unsigned long current3 =0;
unsigned long current4 =0;
int led1 = 1;
int led2 = 1;
int led3 = 1;
int led4 = 1;
void setup() {
Serial.begin(115200);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(2, INPUT_PULLUP);
}////////////////////////////////////
void loop() {
current1 = millis(); //more
if (current1 - pre1 >= timer1) { ///////////// led1
Serial.print( "timer on"); // more
Serial.println(pre1);
pre1 = current1;
if (led1 == LOW) {
led1 = HIGH;
} else {
led1 = LOW;
}
digitalWrite(13, led1);
if (led1 == HIGH){ //////more
timer1 = timer1 + 1000;
} else {
(timer1 + 1000);
}
}
current2 = millis(); // more
if (current2 - pre2 >= timer2) { ////////////// led2
Serial.print( "timer off"); // more
Serial.println(pre2);
pre2 = current2;
if (led2 == LOW) {
led2 = HIGH;
} else {
led2 = LOW;
}
digitalWrite(12, led2);
if (led2 == HIGH){ //////more
timer2 = timer2 + 1000;
} else {
(timer2 + 1000);
}
}
current3 = millis(); // more
if (current3 - pre3 >= timer3) { /////////// led3
Serial.println(pre3);
pre3 = current3;
if (led3 == LOW) {
led3 = HIGH;
} else {
led3 = LOW;
}
digitalWrite(11, led3);
if (led3 == HIGH){ //////more
timer3 = timer3 + 1000;
} else {
(timer3 + 1000);
}
}
current4 = millis(); // more
if (current4 - pre4 >= timer4) {/////////////led4
Serial.println(pre4);
pre4 = current4;
if (led4 == LOW) {
led4 = HIGH;
} else {
led4 = LOW;
}
digitalWrite(10, led4);
if (led4 == HIGH){ //////more
timer4 = timer4 + 1000;
} else {
(timer4 + 1000);
}
}
}///////////endloop