I know attachInterrupt(int, a(), change) will cause delay() not to work, so how can I get around this? My question is, how can I interrupt a() or b() when my input 1 or 0 changes?
I have a set of 4 RGB leds wired to pins 2-13 and a simple switch to pin 14.
a() has a set of instructions (which only lasts a few seconds) to execute while the switch is off
b() has a set of instructions (which lasts for a few hours) to execute while the switch is on
I want to be able to switch between a() and b() once the switch state changes without waiting for a() or b() to complete their instructions.
The 'blink without delay' example comes to mind.
You'd probably want to check the switch every now and again during either procedure, delays might mess this up... interrupts won't be able to stop a procedure either, and if you set the procedures up so that if the switch isn't in the right position anymore, it exits the procedure.
Thus I reckon the best course of action would be to model both procedures after the 'blink without delay' example, with frequent checks of the switch.