|
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
|