Quote:
Originally Posted by peng432
thanks for the reply,
Our team is using a double solenoid would the code still be the same or would their be any minor changes?
|
You would use the DoubleSolenoid class instead of the Solenoid class:
Code:
// Create a new DoubleSolenoid with the forward channel in port 1,
// and the reverse channel in port 2
DoubleSolenoid doubleSolenoid = new DoubleSolenoid(1, 2);
In addition, the call to DoubleSolenoid#set() is a bit different than Solenoid#set(). Instead of taking a boolean value, it takes a DoubleSolenoid.Value object:
Code:
// Set the solenoid to the 'forward' position
doubleSolenoid.set(DoubleSolenoid.Value.kForward);
// Set the solenoid to the 'reverse' position
doubleSolenoid.set(DoubleSolenoid.Value.kReverse);
// Set the solenoid to the 'off' position
doubleSolenoid.set(DoubleSolenoid.Value.kOff);
You can find more details in the FRC javadocs, located at "C:\Users\
user\sunspotfrcsdk\doc\javadoc\index.html" on any computer that has the FRC Java plugins installed.