-->
Page 1 of 2

ISR on ESP8266 fails to fire.

PostPosted: Wed Nov 20, 2019 6:07 am
by parijip
I am trying to interrupt a ESP8266 nodemcu using the interrupt from ADXL345. I know that the interrupt is being raised - as a function call to read the interrupt in the loop does get to it - however, the ISR registered against that interrupt fails to get called and set the global variable - which the beginning of the loop fails to read... Attached the sketch for your reference...

Re: ISR on ESP8266 fails to fire.

PostPosted: Wed Nov 20, 2019 4:05 pm
by Anttiduino
I don't know how it goes with ESP8266 but in many environments it is a bad idea to change variable values in an interrupt. But defining the variable "volatile" may help:

volatile uint8_t intSrc = 0; // The interrupt source is read into this

See e.g. this

Re: ISR on ESP8266 fails to fire.

PostPosted: Wed Nov 20, 2019 8:06 pm
by parijip
Thanks a lot for your reply.

Anttiduino wrote:volatile uint8_t intSrc = 0; // The interrupt source is read into this


Added the "volatile" qualifier in the sketch. However, that did not make any difference.

Re: ISR on ESP8266 fails to fire.

PostPosted: Fri Nov 22, 2019 7:08 pm
by Anttiduino
I don't this if-statement works as you have planned ??

Code: Select allif (intSrc && 16 == 16) {


"&&" is "logical AND" -operator and is evaluated only after "==" -operator ??