Hopefully a pretty simple question here, for the arduino uno is there a command to ignore the inputs of a pin within a specific loop? I would like to base the programs actions based on whichever input comes in first, regardless of what the other input sees later. Due to the nature of the program i have 'if' loops for both inputs, and without telling the program to specifically ignore the other input until that loop is finished it seems to get confused.
xkcd:
Hopefully a pretty simple question here, for the arduino uno is there a command to ignore the inputs of a pin within a specific loop? I would like to base the programs actions based on whichever input comes in first, regardless of what the other input sees later. Due to the nature of the program i have 'if' loops for both inputs, and without telling the program to specifically ignore the other input until that loop is finished it seems to get confused.
The confusion is most likely in the structure of your program and your specific use of the if command(s). Why don't you just post your code and briefly explain what you are trying to accomplish and I'm sure help will follow.
Lefty
No, if you want to conditionally ignore an input you must code it up yourself. One boolean variable per pin would do it, or you could use an array and write a wrapper around digitalRead() to filter your inputs according to the "ignore array".
It might not be the best way to code things however - since the meaning of the code is then dependent on the past history in hard to understand ways - often its best to code things in terms of explicit states and have a clear state-transition logic that's easy to understand. Each state is coded separately so its behaviour is in one place in the code and not dependent on anything else. It is then much easier to test piece-by-piece.