I'm trying to figure out how to create a sketch that keeps track of 12 switches. I'm having a little trouble wrapping my head around the logic, though.
I'm fine with the concept of assigning a different function to each button—that's no problem. I've also figured out how to keep that function going for as long as a given button is held down. What I can't figure out is how to trigger yet another function if more than one button is held down at any given time.
Any ideas? Pseudo code is fine - I'm really just looking for some help to understand how to do this conceptually.
Here's what I'm hoping to do in short:
Check button states.
if only ONE button is being held, play audio file associated with button.
if MORE THAN ONE button is held, stop audio altogether.
Multiple things at same time, here is my understanding
Each button press is associated to a function, to execute some thing.
Dont use delay in those functions, this will delay other function's execution.
As per my knowledge, each function call execute sequentially, even though multiple button pressed simultaneously. That means Button 1 function executes, once it completes button 2 function execute and so on. So any delay in Button1 function will delay Button2 function execution.
@JML, I think I misunderstood the requirement, sorry for that. I was thinking OP wants to execute different function for each button. Yes my code will do execution in sequence.