const int ledPin = 11;
int State = LOW;
//unsigned long previousMillis;
long previousMillis = 0;
const long interval_1 = 10000;
const long interval_2 = 30000;
const long interval_3 = 50000;
void setup() {
pinMode(ledPin, OUTPUT);
//Serial.begin(9600);
}
void loop() {
unsigned long currentMillis = millis ( );
if ( State == LOW ) {
if ( currentMillis - previousMillis >= interval_1 ) {
previousMillis = currentMillis;
State = HIGH; //потушили
Serial.print(" Go to High ");
Serial.println(currentMillis);
digitalWrite (ledPin, State );
}}
if ( State == HIGH ) {
if ( currentMillis - previousMillis >= interval_2 ) {
previousMillis = currentMillis;
State = LOW; //включили
Serial.print(" Go to Low ");
Serial.println(currentMillis);
digitalWrite ( ledPin, State );
}}
if ( State == LOW ) {
if ( currentMillis - previousMillis >= interval_3 ) {
previousMillis = currentMillis;
State = HIGH; //потушили
Serial.print(" Go to High ");
Serial.println(currentMillis);
digitalWrite (ledPin, State );
}
}
}