Programming Double Solenoids

Hello from team 253,

How do you program double solenoids. Please answer with some example code.

Thank You!

Shane

The DoubleSolenoid class is pretty easy to work with:


// Create a double solenoid with the forward channel in port 1 and the reverse
// channel in port 2
DoubleSolenoid solenoid = new DoubleSolenoid(1, 2);

// Setting values
solenoid.set(DoubleSolenoid.Value.kForward);   // Set the solenoid to forward
solenoid.set(DoubleSolenoid.Value.kReverse);   // Set the solenoid to reverse
solenoid.set(DoubleSolenoid.Value.kOff);       // Turn off the solenoid