We are using a microswitch on our robot to add and subtract the balls. The MicroswitchesWe are plugged with GND on C and SIG on NO (normally open).
I will add the code when I get the chance but it is basically:
Int totalBalls = 2
public int microSwitch(int totalBalls)
If (addball.get() = true and totalBalls >= 0 and < 3
Then totalBalls += 1
If (minusball.get() = true and totalBalls > 0 and <= 3
Then totalBalls -= 1
Else if totalBalls > 3 || totalBalls < 0
Then totalBalls
return totalBalls
When I hit the switch, it calculates the addition or subtraction, but when the switch is released, it goes back to the original value. Why an’t a robot count?