How do you toggle the value of a binary variable?
Posted: Wed Dec 30, 2009 10:34 pm
I would like to read a binary variable (ExtendedMode)and take an action based on it's value (0 or 1).
What I'm struggling with this variable will be set by a push button.
So for example, the program starts running my my variable ExtendedMode is initialized with a value of 0, now a momentary push button is pressed and I want my ExtendedMode to be 1 until next time when the button is pressed again when I want it to toggle back to 0.
Can you use something like ExtendedMode = !ExtendedMode or is there some trick I'm supposed to use?
Thanks
D.
What I'm struggling with this variable will be set by a push button.
So for example, the program starts running my my variable ExtendedMode is initialized with a value of 0, now a momentary push button is pressed and I want my ExtendedMode to be 1 until next time when the button is pressed again when I want it to toggle back to 0.
Can you use something like ExtendedMode = !ExtendedMode or is there some trick I'm supposed to use?
Thanks
D.