View Full Version : Programming Double Solenoids
ShaneKent253
11-02-2014, 22:00
Hello from team 253,
How do you program double solenoids. Please answer with some example code.
Thank You!
Shane
Domenic Rodriguez
11-02-2014, 22:37
The DoubleSolenoid (http://robotics.francisparker.org/javadoc/edu/wpi/first/wpilibj/DoubleSolenoid.html) 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
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.