I am working with debouncing of simple switches and am wondering if I can make a simple debounce function that can just be easily applied to any button without the function having to be relabeled and rewritten over and over.
This is what I currently have:
boolean debounceUp(boolean last)
boolean current = digitalRead(switchPinup);
if (last != current)
current = digitalRead(switchPinup);
The problem is if I want to add another switch I have to write the same Function again to reference a different switch pin etc.
Is there way to give the function the ability to take multiple inputs at the same time and give multiple outputs? Such as different debounced button states? The purpose is just to simplify the code for 8 - 10 buttons which need debouncing.