![]() |
Robots can't count: Microswitches
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: Code:
Int totalBalls = 2When 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? |
Re: Robots can't count: Microswitches
If your pseudo code matches your real code, the module level variable totalBalls defined at:
Quote:
Quote:
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 |
| All times are GMT -5. The time now is 09:53. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi