View Single Post
  #2   Spotlight this post!  
Unread 06-02-2012, 11:52
lemiant's Avatar
lemiant lemiant is offline
the Dreamer
AKA: Alex
FRC #4334 (Alberta Tech Alliance)
Team Role: Leadership
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Calgary, AB, Canada
Posts: 562
lemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond reputelemiant has a reputation beyond repute
It's a little complicated. You need to start by detecting each button press as a unique event (instead of toggling for every loop during which the button is held down). At the end of every loop save the old button value. Only when the current value is pressed and the one from the previous loop is not pressed should you toggle the setting. Then you create a variable to store the state of your toggle and then you just change it every time we see a button press with the above logic.
__________________
FRC Team 4334
2012 - Archimedes Champions, IRI Champions
2013 - Western Canadian Regional Winner, Galileo Quarter-Finalilst

Reply With Quote