Thread: PBasic Probelm
View Single Post
  #5   Spotlight this post!  
Unread 08-04-2004, 10:14
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,588
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: PBasic Probelm

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.