Page 1 of 1

AttachInterrupt on NodeMCU

Posted: Wed Jan 18, 2017 10:50 pm
by pxlstuermer
I'm trying to figure out how the AttachedInterrupt works on the NodeMCU.
Everything I found tells me that this code is OK?!

Code: Select all

void setup() {
  pinMode(D4, INPUT);
  attachInterrupt(D4, doSth(), CHANGE);

void loop() {

void doSth() {

But I just get this error:


I still have no idea after hours of research!
Thanks a lot in advance :-)

Re: AttachInterrupt on NodeMCU

Posted: Fri Mar 24, 2017 5:53 pm
by Tercero
attachInterrupt expect a pointer to the function, not its returned value. If you call doSth(), you get the returned value, in your case, it's a void.
Try to remove the parenthesis after doSth:

Code: Select all

attachInterrupt(D4, doSth, CHANGE);