View Single Post
  #4   Spotlight this post!  
Unread 18-02-2012, 08:46
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: Help Please!(Rookie Team)

Quote:
Originally Posted by NS_Radication View Post
Correction:

relay.set(Relay.Value.kForward or kReverse)

Should be

relay.setDirection(Relay.Direction.kForward or kReverse, or kBoth);

Hope this helps! Happy Competitions!
setDirection() tells it what directions it CAN go in, while set() tells it which direction to actually go. If you're only setting your relay to Value.kOn or Value.kOff, then setting the direction is ok, but it still isn't a good idea because the relay is reinitialized and its value effectively set to kOff on every call to setDirection.

I'm getting all my info about the relay from the source (from sunspotfrcsdk/lib/WPILibJ/src/edu/wpi/first/wpilibj/Relay.java in this case), in case you want to check my info
Reply With Quote