This is what our team is using, tell me if it works ( youll have to set the solenoids to whatever yours is named.
Code:
DS.set(DoubleSolenoid.Value.kOff); // sets both Solenoids to off at the beginning of Teleop.
DS1.set(DoubleSolenoid.Value.kOff);// ^
if(moveStick.getRawButton(1)) // A Button
{
DS1.set(DoubleSolenoid.Value.kReverse); // Lowers pistons to raise robot up
// DS1.set(DoubleSolenoid.Value.kReverse);
}
else
if(moveStick.getRawButton(4)) // Y Button
{
DS1.set(DoubleSolenoid.Value.kForward); // raises pistons to prepare for ascension
// DS1.set(DoubleSolenoid.Value.kForward);
}
basically the solenoids are off at the beginning and only if the button is pressed will the direction of the solenoids change. hope this helps!!