Pneumatics not working

How do I set my pneumatics to my controller.

I currently have this.
if(liftshooter.getRawButton(1)){
shooter.set(DoubleSolenoid.Value.kForward);
}
else if(liftshooter.getRawButton(3)){
shooter.set(DoubleSolenoid.Value.kReverse);
}
else{
shooter.set(DoubleSolenoid.Value.kOff);
}

Up top I have

DoubleSolenoid shooter = new DoubleSolenoid(4,5);
I assume that 4,5 are the ports, and were sure thats correct, please help, asap.

Try adding the following line to your robotInit() code after your shooter has been constructed:


LiveWindow.addActuator("Shooter", "Solenoid", shooter);

Deploy your program and put the driver station in “Test” mode instead of “Teleop” mode. This should give you a control to verify that you can operate the solenoid. If you don’t see the control, that probably indicates there is an error (look in the console window of the DriverStation for a stack trace). If you see the control, but the solenoid doesn’t respond, it indicates an electrical/physical issue.

Next, the code fragment you provided looks like it should work. However, it requires the operator to press and hold the buttons down in order to put the solenoid in the forward or reverse position. As soon as a button is released, the solenoid will go back to the off state - is that what you want it to do?

This is what our team is using, tell me if it works ( youll have to set the solenoids to whatever yours is named.


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!!