View Single Post
  #1   Spotlight this post!  
Unread 22-02-2012, 13:47
NS_Radication's Avatar
NS_Radication NS_Radication is offline
Student
AKA: Marco Schoener
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Tampa
Posts: 88
NS_Radication is an unknown quantity at this point
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 = 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?
__________________
Team 1369
Senior
Head Programmer (Java)
Head Electrician
Reply With Quote