|
Re: Problems with buttons and structures
If you have the false cases setting the motors to zero then you have the same code turning the motors on and turning the motors off. (ie when you press button 2, the first case statement evaluates as false, setting the motors to zero, the second case statement evaluates to true, which tries to turn the motors on) The order of execution is indeterminate in the code you provided which means that you're going to get unpredictable results.
There are a couple of ways to achieve what you want. One would be to nest the two case structures. (check button 2 in the false case of button 1). Another would be to use cascading select blocks to determine which value to send to the Set Motor blocks.
Hope that helps.
__________________
Team 177 | Software Engineer
|