Looking for some pointers on the best way to combine button/switch events(or alternative options all together). I apologize now for the long-winded post...
Right now I have a SP switch set up in a loop and monitored for changes via the simple command (switchState != lastswitchState).
Works great. If the switch is flipped "on", the pin goes High and action A is performed. Flip it "off" and the pin goes Low and action A is stopped. Basic stuff.
I ran into a problem where this simple setup spontaneously failed out of the blue after working flawlessly for years. The switch was in the on (High) position and action A was running. Out of nowhere action A was terminated despite the switch being in the on position. Long story short - bad things happened and many hobbits were lost.
My investigation showed that the hardware link between the pin and the controller itself had failed. (ended up being a solder issue with the SM controller which was fixed with a re-flow). So I'm looking for insurance to prevent this issue, the outcome anyway from happening again.
With a DP switch I would like to monitor two pins. When pin X is High and pin Y is Low, that is "off". The inverse would be "on".
Is there a "best practice" method for what I'm trying to achieve? Any pointers would be great appreciated.