View Single Post
  #3   Spotlight this post!  
Unread 10-03-2011, 19:46
rclothier rclothier is offline
Coach, Team 1723
AKA: Russell Clothier
FRC #1723 (The FIRST Bots of Independence, "The FBI")
Team Role: Coach
 
Join Date: Jan 2011
Rookie Year: 2006
Location: Independence, MO
Posts: 42
rclothier is on a distinguished road
Re: Checking Rookie Programmer's code to switch between motors

While there are certainly ways to make a single button push switch from one mode to another, the easiest thing (if I'm interpreting your code correctly) would be to just hold down Button 11. Otherwise, you'll have to add a shift register and/or global variable to keep track of when you press the button. You'd only want to change states when you just pressed the button, meaning a) the last time through, the button wasn't pressed, AND b) this time, the button is pressed. So you'd have to store what the button was the last time, recall it, compare it to what the button is this time, and only make a change when Last Time = False and This Time = True.
Reply With Quote