It looks to me (based on the javadoc) that the default constructor for the Relay objects defaults to allowing the Relay object to operate in both directions.
Hence your constuctor:
Code:
Relay spike = new Relay(1);
Should be the same as:
Code:
Relay spike = new Relay(1, Relay.Direction.kBoth);
This means you should be able to put your relay in 3 different states:
Code:
public void autonomous() {
// SimpleRobot autonomous test code that transitions the relay through
// all 3 states (2 seconds forward, 2 seconds reverse, then off).
// +12 volts out (think this displays the green LED on DSC)
spike.set(Relay.Value.kForward);
Timer.delay(2.0);
// -12 volts out (think this displays the red LED on DSC)
spike.set(Relay.Value.kReverse);
Timer.delay(2.0);
// 0 volts out
spike.set(Relay.Value.kOff);
}
So, from your previous posts: It sounds like you are constructing the Relay so that it will operate in all three states. But, it sounds like you are not seeing the green LED light up when you set the forward state. There are at least three possibilities:
- Your code that sets the forward state is being reached, however after setting the forward state, another portion of your code is executed which immediately sets the relay back to the reverse or off state.
- Your code that sets the forward state is not being reached.
- There is a hardware failure in digital module, 37 pin cable or digital side car. You can try using a different relay channel or substituting parts to check this. Digital side cars do fail - our team has already had to replace one this season.