Javadocs for the 2013 season are here:
http://team2168.org/javadoc/
This likely will be updated once 2014 code is available.
The Solenoid class(es) and the Relay class can both be used to achieve motion of a pneumatic cylinder. The difference between them is in the type of hardware each one controls.
As you noted, the
Relay class controls a Spike. The Spike would have it's M+ and M- terminals connected to the red wires on the solenoid (assuming the valve has two solenoids on it). The black wires from the two solenoids would be tied together and brought back to the power distribution board or DSC ground.
The
Solenoid and
DoubleSolenoid classes take the spike out of the equation. They control the same solenoid valve hardware, but through the NI relay module (9472), which resides in the
3rd slot of the cRIO.
Also, for the compressor... take a look at the javadoc for the
Compressor class. The constructor needs two parameters: the location of the pressure switch and the location of the relay turning the compressor on/off. If you've wired things up right, this is a set-it-and-forget-it class. Al you
need to do is enable the compressor and it will automatically turn itself on and off. I would suggest placing compressor code in the robotInit() method as follows:
Code:
Compressor compressor;
int switchChannel = 1; //wherever these are plugged in on the DSC
int relayChannel = 1;
robotInit() {
compressor = new Compressor(switchChannel, relayChannel);
compressor.start();
}
What you had would work, but moving the compressor code out of the auto method helps to organize the code a bit better IMO.