boolean rebote(boolean eAnterior)
{
boolean eActual = digitalRead(boton);
if (eAnterior != eActual)
{
delay(5); //<<< delay for 5 seconds
eActual = digitalRead(boton); //<<< then take the next read as debounced?
}
return eActual;
}
This code does not debounce. in the IDE, open Example/Digital/Debounce.ino