Using two Uno's and I2C to communicate with each other, I have this working fine and doing as I want. But now I want to move the worker (slave) code from the sketch into my own class library.
What I want to do is remove all reference of Wire from the sketch and put it intomy class file source code. So in my class INIT() I have the Wire.begin(), which works, however I cannot get right how to register my own class method "receiveEvent()" in the Wire.onReceive(receiveEvent). I keep getting compiler errors.
In my class header I declare ...
void receiveEvent (int howMany)
Then in the INIT() method of class source (ie. class called "MyClass").
Wire.onReceive(receiveEvent); //this won't compile
Wire.onReceive(MyClass::receiveEvent); //this won't compile
Sorry I don't have exact compiler error message with my, but its along the lines of "can't find method 'receiveEvent'", and/or no Wire.onReceive method found to match signature.
Anyone know how to declare your ISR events in your own class source file?
Thanks for any tips/comments.