Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback for button release? #30

Open
mrdc opened this issue Nov 12, 2019 · 6 comments
Open

Callback for button release? #30

mrdc opened this issue Nov 12, 2019 · 6 comments

Comments

@mrdc
Copy link

mrdc commented Nov 12, 2019

Hello,

Would be nice to add a callback for button release.

Thanks!

@elC0mpa
Copy link
Collaborator

elC0mpa commented Nov 12, 2019

There is a callback for button release, is onPressed event, maybe what you mean is that it would be nice to have a onReleasedFor event. Thanks for your feedback

@mrdc
Copy link
Author

mrdc commented Nov 12, 2019

Yes, just for the release event. I need to catch it once when there is HIGH on pin, do some work and catch it once again when there is LOW on pin. What I have now is that my Serial is flooded if I use wasPressed and isReleased. Can't catch HIGH once and LOW once.

@source-creator
Copy link

Greetings @elC0mpa
The callback is not called for me when the button is released, only when it is pressed.
Perhaps I am missing something?

@evert-arias
Copy link
Owner

Hi @source-creator
Please provide your code to see if there is any issue and we'll try to reproduce it in our side.

@gogreenpower
Copy link

Did anyone get a OnRelease Callback working?

@eppfel
Copy link
Contributor

eppfel commented May 3, 2021

I setup a check for btn.isReleased() after btn.read() once pressedFor(X)was triggered.

btn.read();
if (waspressedforsometime && btn.isReleased())
{
  onRelease();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants