I am trying to assign buttons to control a Tetrix DC motor when ever i assign 2 functions to control the same motor say one button forward and one backward the motor coughs and jumps and vibrates moving spastically. I attached the code below, how could i solve this problem?
What the above “if” is saying is “If Button 2 on Joystick 2 is pushed, set power to motorF to 100%. Otherwise, set it to 0”.
This one is saying “if Button 1 on Joystick 2 is pushed, set power to motorF to 100% in reverse. Otherwise, set it to 0”.
The problem is not with the if (true) conditions, it’s the else conditions that are conflicting with each other. If Button 1 is pressed, then button might or might be pressed, so motorF shouldn’t go (the else conditions). Likewise for Button 2.