View Single Post
  #1   Spotlight this post!  
Unread 16-02-2013, 12:51
Negative 9 Negative 9 is offline
Registered User
FRC #0611
 
Join Date: Dec 2012
Location: Mclean, VA
Posts: 46
Negative 9 is an unknown quantity at this point
Using Spike Relays in Java?

Can anyone explain to me the best way to use Relays in code? The API confuses me. There are several ways to construct the relays and set them to values and I'm having trouble understanding the differences between them.

I'm trying to use a relay to control a window motor so from what I can tell I am supposed to construct the relay like this:

Code:
relay = new Relay(1, Relay.Direction.kBoth);
and I'm supposed to control the Relay by doing something like this:

Code:
if(joyRight.getRawButton(4)) {
	relay.set(Relay.Value.kON);
	relay.set(Relay.Direction.kForward);
} else if(joyRight.getRawButton(5)) {
	relay.set(Relay.Value.kON);
	relay.set(Relay.Direction.kReverse);
} else {
	relay.set(Relay.Value.kOff);
}
If that's all good then the other possibility is that it's wired incorrectly. Does anyone know which section of the DigitalSidecar the triple wire is supposed to be plugged in? The diagnostic light on the Relay is a solid yellow-orange color which I assume mean that it's been initialized but isn't receiving any signals.

Any and all help is appreciated!
Reply With Quote