EasyButton icon indicating copy to clipboard operation
EasyButton copied to clipboard

Interrupt example not working with 1.2.1

Open octave opened this issue 5 years ago • 9 comments

With version 1.2.1 on Interrupt example:

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

octave avatar Apr 09 '20 01:04 octave

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

evert-arias avatar Apr 09 '20 02:04 evert-arias

@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 read method 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 avatar Apr 09 '20 02:04 evert-arias

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

evert-arias avatar Apr 11 '20 19:04 evert-arias

@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 avatar Apr 23 '20 17:04 MattStarfield

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!!

MattStarfield avatar Apr 23 '20 17:04 MattStarfield

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

evert-arias avatar May 16 '20 18:05 evert-arias

Has the documentation been updated yet?

pnaybour avatar Sep 04 '21 07:09 pnaybour

Please update the document, 2022.04.26

wanggaoteng avatar Apr 26 '22 11:04 wanggaoteng

Please update the documentation, 2022.10.19

goutamreddy avatar Oct 19 '22 15:10 goutamreddy