Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I'm using JChristensen's Button Library to debounce my buttons and provide extra functionality. I'm trying to use his press & hold function to do something if the button is pressed and held for greater than 2 seconds. If it is just pressed momentarily it should do something else. His example use switch cases, and I couldn't get it to work. Here is my example that currently doesn't work. https://github.com/JChristensen/Button
- if (clearBtn.pressedFor(2000)) { // Enter settings menu
- Serial.println("Settings Menu");
- while (clearBtn.read()!=1) {
- //Stay in the settings menu until the button is pressed again to exit.
- variable1=5;
- } // End While
- return; // Hopefully not proceed down to the next if statement } if (clearBtn.wasReleased() && !clearBtn.pressedFor(2000)) { varaible1=0; delay(50);
- Can anyone help please? My serial output repeats "Entering menu over and over. Once I let go of the button variable1 always gets set to 0.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement