Quote:
|
Originally Posted by PBoss
When I press a button, I want the controller to run a sub routine. That is simple, I know, but here is the catch:
If while running the sub-routine, a second button is pressed, I want the RC to ignore the second button. When the RC is done executing the subroutine, then I want it to be able to recieve a signal from any other button, but not until it is done executing the first sub routine.
|
One thing you have to remember is that the state of the buttons can only change when you do the serin statement at the top of your code. Thus, even if button2 is pressed while you are doing the subroutine for button1, you won't see that button2 is pressed until the next loop. If button1 and button2 were pressed at approximately the same time, you'll see both after the serin. In other words, you never have to worry about subroutine2 executing in the middle of subroutine1, your code will flow in order.