const int GPS = 2;
const int BLOQUEO = 4;
int estadoActual, estadoAnterior = 0;
bool inicioBloqueo = false;
unsigned long inicioTimer;
void setup() {
pinMode (GPS, INPUT);
pinMode (BLOQUEO, OUTPUT);
}
void loop() {
estadoActual = digitalRead (GPS);
if (estadoActual && !estadoAnterior) {
inicioTimer = millis();
inicioBloqueo = true;
digitalWrite (BLOQUEO, HIGH);
}
estadoAnterior = estadoActual;
if (inicioBloqueo) {
if (millis() - inicioTimer > 1500UL) {
digitalWrite (BLOQUEO, LOW);
inicioBloqueo = false;
}
}
}