Hi!
I have been working on building motion sensors with MySensors to be able to trigger events on my Vera. Earlier I was able to get a few sensors working using 3.3V 8MHz Pro Minis. Now I am trying to build one with a custom ATMega328 board that uses the internal RC oscillator. For some reason I am unable to get the board to respond to pin change interrupts when using MySensors gw.sleep() using the MotionSensor.ino. I debugged the issue with a Pro Mini that (afaicr) is also using the internal oscillator instead of the external oscillator on the board. Everything however works correctly if I do not include MySensors code in my sketch and use attachInterrupt with mode set to CHANGE:
void setup() {
Serial.begin(115200);
Serial.println("Boot");
pinMode(3, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(3), handler, CHANGE);
}
void loop() {
}
void handler() {
Serial.println("foo");
}
However if I pass LOW mode to gw.sleep, the interrupt seems to work and a message seems to be sent to the controller correctly. But of course this only happens when the pin is in LOW state and not on changes.
Has anyone got a clue on what might be causing the issue? I read through the interrupt handling code in MySensors that I believe is relevant in my case (MyHwATMega328 class), but was unable to find anything that might cause the issue.
edit Forgot to mention, but I am using version 1.5 of MySensors /edit