#define pinSET 18
long Timer_Startup = 0;
const long Period_Startup = 10000;
long Timer_Active = 0;
const long Period_Active = 3000;
bool isActive = false;
void setup() {
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(pinSET, OUTPUT);
digitalWrite(pinSET, LOW);
}
void loop() {
if ((Timer_Startup == 0) or (millis() > Timer_Startup + Period_Startup)) {
Timer_Startup = millis();
Timer_Active = Timer_Startup;
digitalWrite(pinSET, HIGH);
isActive = true;
Serial.println("SET ON");
}
if ((isActive == true) and (millis() > Timer_Active + Period_Active)) {
digitalWrite(pinSET, LOW);
isActive = false;
Serial.println("SET OFF");
}
delay(1000);
Serial.println(".");
}