As a title, to avoid accidental pressures, i need to create a button mode push with a delay of 3 seconds before start the code, and break if the time is less of 3 seconds.
I try with this sketch but there is something wrong
long currentMillis = 0;
int periodo = 3000;
long startMillis = 0;
BLYNK_WRITE(V1) {
int state = param.asInt();
bool premuto = false;
if (state == 1) {
premuto = true;
startMillis = millis();
currentMillis = startMillis;
while (currentMillis < (startMillis + periodo)) {
currentMillis = millis();
if (param.asInt() == 0) premuto = false;
else premuto = true;
}
if (currentMillis >= startMillis && premuto)
digitalWrite(15, LOW);
}
else
digitalWrite(15, HIGH);
}