If your pseudo code matches your real code, the module level variable totalBalls defined at:
Quote:
Originally Posted by NS_Radication
Int totalBalls = 2
|
Will never be updated because the variable totalBalls defined as a argument to your method will take precedence.
Quote:
Originally Posted by NS_Radication
public int microSwitch(int totalBalls)
|
Try renaming the module level variable to m_totalBalls or another name. Also, you only need to check the upper limit when adding:
If (addball.get() = true and totalBalls < 3
Then totalBalls += 1
And the lower limit when subtracting:
If (minusball.get() = true and totalBalls > 0
Then totalBalls -= 1