dose anyone know why the following statement dosent compile
attachInterrupt(0, LiquidCrystal.keypadISR, LOW);
the keypadISR is in the library LiquidCrystal which i have modified
is there a way around this?
thanks in advance for any help
dose anyone know why the following statement dosent compile
attachInterrupt(0, LiquidCrystal.keypadISR, LOW);
the keypadISR is in the library LiquidCrystal which i have modified
is there a way around this?
thanks in advance for any help
I think it is because at compile time the address of this function is not known, as there is no instance of LiquidCrystal at compiletime, it is created runtime...
so how can i call the routine?
so how can i call the routine?
You can't. You can not make an interrupt handler from a class method, unless that method is static. Otherwise, how would the interrupt vector know which instance the interrupt is for?
I would try something like the following - don't know if it works not tested - but at least the addresses can be resolved ...
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
Serial.begin(115200);
Serial.println("Start...");
attachInterrupt(0, myISR, LOW);
}
void loop()
{
Serial.println("...");
}
void myISR()
{
lcd.keypadISR();
}
ok thanks for that robtillaart your suggestion works
Great, learned something today
Great, learned something today
But, of course, it isn't the sketch figuring out which instance of the LiquidCrystal class the interrupt is for. It was the programmer that did that.