evert-arias / EasyButton

Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
https://easybtn.earias.me
MIT License
447 stars 62 forks source link

Interrupt example not working with 1.2.1 #40

Open octave opened 4 years ago

octave commented 4 years ago

With version 1.2.1 on Interrupt example:

button.read(INTERRUPT); generates: error: 'INTERRUPT' was not declared in this scope

evert-arias commented 4 years ago

Hi @octave I will take a look at it and get back to you. I appreciate your feedback.

evert-arias commented 4 years ago

@octave This is what is happening. In v1.2.1 we fixed an issue with the INTERRUPT macro as it was already defined in the arduino environment. To fix such problem, we renamed INTERRUPT to EASYBUTTON_READ_TYPE_INTERRUPT. This update should have been released as a major version update since it was a breaking change.

We will be fixing this error as well as update the corresponding examples in v2.0 soon. Meanwhile all you have to do is use EASYBUTTON_READ_TYPE_INTERRUPT instead of INTERRUPT when calling the readmethod as follow:

void buttonISR()
{
 read() function
  button.read(EASYBUTTON_READ_TYPE_INTERRUPT);
}

I am very sorry for this inconvenience and I appreciate your feedback.

evert-arias commented 4 years ago

Hi @octave In version 2.0, that has been released today, there is no need to pass any arguments when calling the button.read() function. There more features included in this release, feel free to give it a try.

https://github.com/evert-arias/EasyButton/releases/tag/v2.0.0

MattStarfield commented 4 years ago

@evert-arias reminder to update the website documentation to reflect this change. I just updated to v2.0 and was spinning my wheels for a few hours until I found this thread.

https://easybtn.earias.me/docs/fundamentals#external-interrupts

MattStarfield commented 4 years ago

The Interrupts.ino example also still includes the comment to use the INTERRUPT parameter:

void buttonISR()
{
  /*
    When button is being used through external interrupts, 
    parameter INTERRUPT must be passed to read() function
   */
  button.read();
}

Awesome work on this super useful library. Thanks for all of your effort!!

evert-arias commented 4 years ago

Hi @MattGarfield I will fix that as soon as possible. Thank you very much for your comment, I really appreciate your feedback.

pnaybour commented 2 years ago

Has the documentation been updated yet?

wanggaoteng commented 2 years ago

Please update the document, 2022.04.26

goutamreddy commented 1 year ago

Please update the documentation, 2022.10.19