Go to Post MAKE SURE THE BATTERY DOES NOT FALL OUT - magnets [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:49.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi