Resuming loop after ISR function - RESOLVED

Ok I think it's now resolved - this version of the code works after I change wakeUpPin to digitalPinToInterrupt(2) in the activateRelay function. So I guess the problem was sloppy coding from me. Thank you very much for the assistance.

Thanks - looks like it works now though, see #21. Thanks for the help.

Yes. I will read Nick Gammon again to see if in some case it was not silly. Or if it even is he who I have channeled in perpetuating the idea.

In @donaldosaurus's code, and I suspect many other sleep/wake-up cases, the ISR doesn't need to do anything.

  void activateRelay(){ 
    digitalWrite(relayPin, HIGH);
  }

Here the digitalWrite() could just be placed where the sketch news says "waking up".

As for where the sketch picks up after the interrupt, that would be inside the function the put the Arduino to sleep, so form a high level point of view, execution begins with the line of code after the call to LowPower.powerDown().

Nick Gammon does not use a library, so you get to see the code sequence at the lowest level.

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.