View Single Post
  #3   Spotlight this post!  
Unread 26-01-2012, 10:20
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Help?-Vex pro Spike Switch?

Quote:
Originally Posted by Cheeset2 View Post
I realize that i gave no info about our problem, but we really have nothing done. We have tried many things but none of them have worked and i think if we just saw an example of code that worked it would help us out a boat load
Import the Relay class
Code:
import edu.wpi.first.wpilibj.Relay;
Create a Relay object (I'll call mine Tom)
Code:
Relay Tom = new Relay(PORT YOU PLUGGED THE PWM WIRE INTO ON DSC);
The code to turn the spike on is something like
Code:
Tom.set(Relay.Value.kForward);
I'm not at a computer with the SDK but I'll check with the JavaDocs to make sure this is correct in a moment.

Edit: After a quick check this seems correct. To disable the relay, use this:
Code:
Tom.set(Relay.Value.kOff);

Last edited by eddie12390 : 26-01-2012 at 10:28.
Reply With Quote