View Single Post
  #4   Spotlight this post!  
Unread 26-01-2012, 11:28
Cheeset2 Cheeset2 is offline
Registered User
FRC #4254
 
Join Date: Jan 2012
Location: New York
Posts: 9
Cheeset2 is an unknown quantity at this point
Re: Help?-Vex pro Spike Switch?

Quote:
Originally Posted by eddie12390 View Post
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);

Thank you very much. We will be sure to try that when we get our connection to the robot back....
Reply With Quote