Hi, do you know how can I declare and call an ISR inside a library? if I use this code in the cpp file:
int myclass::myMethod()
{
attachInterrupt(1, isrName(), RISING);
...
...
}
void myclass::isrName() //This is the function that the interupt calls
{
//isr code
}
thanks, I have tried as you told me to write
attachInterrupt(1, myclass::isrName, RISING);
but the complier tell me " error: argument of type 'void (myclass:: ) ()' does not match 'void (*)()' "
I havent understand this "You can't call a specific instance's method. You could make the method static" may be this is my problem.
Are you telling that myMethod must be static?
Why can't I call a specific instance's method?
Because all you are telling the ISR is to call a function by address. You would have to get very creative to determine the address of the function to call when the function is an instance method.