Need help programming Double Solenoids!

Hello again, I know I have posted this before but I have made slight modifications to the code and wondered if anyone could take a look at it to see if it has any errors. I ask this because when we tested it, it did not work. The A and B buttons were pressed, it just wasn’t moving the piston. I have checked the CAN ID and made sure it is the same as the value I initialized it in the code, so that’s not likely to be an issue. Thanks for the help in advance guys.

Robot.java:


package org.usfirst.frc.team4528.robot;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Victor;

public class Robot extends SampleRobot 
{
	Victor frontLeft;
	Victor rearLeft;
	Victor frontRight;
	Victor rearRight;
	Victor motor;	//add-on
    RobotDrive myRobot;
    XBoxJoystick stick;
    Compressor compressor;
    DoubleSolenoid piston;
    
    public Robot() 
    {
    	frontLeft = new Victor(2);
    	rearLeft = new Victor(3);
    	frontRight = new Victor(0);
    	rearRight = new Victor(1);
    	motor = new Victor(4);		//add-on
        myRobot = new RobotDrive(frontLeft, rearLeft, frontRight, rearRight);
        stick = new XBoxJoystick(0);
        compressor = new Compressor();	//null parameter
        piston = new DoubleSolenoid(0, 4, 5);	
        //CAN ID is first parameter(null if 0), second parameter is forward port and
        //third parameter is reverse port
    }
    
  //add-on
    

  	public void runMotor()
  	{
          	if(stick.getLeftZ() > 0 && stick.getRightZ() == 0)		//Changed so not functional if both pressed
          	{
          		motor.set(stick.getLeftZ());
          	}
          	else if(stick.getRightZ() > 0 && stick.getLeftZ() == 0)	//Changed so not functional if both pressed
          	{
          		motor.set(-stick.getRightZ());
          	}
          	else
          	{
          		motor.set(0.0);
          	}
  	}

  	public void moveArm()
  	{
  		compressor.start();
  		compressor.setClosedLoopControl(true);
  		
  		if(stick.getAButton() == true && stick.getBButton() != true)
  		{
  			piston.set(DoubleSolenoid.Value.kForward);
  		}
  		else if(stick.getBButton() == true && stick.getAButton() != true)
  		{
  			piston.set(DoubleSolenoid.Value.kReverse);
  		}
  		else
  		{
  			piston.set(DoubleSolenoid.Value.kOff);
  		}
  	}

    /**
     * Drive left & right motors for 2 seconds then stop
     */
    public void autonomous() 
    {
    	while(isAutonomous() && isEnabled())
    	{
    		//Drives full forward for 5 seconds then stops
    		myRobot.drive(1.0, 0.0);
    		Timer.delay(5.0);
    		myRobot.drive(0.0, 0.0);
    	}
    }
    
    /**
     * Runs the motors with arcade steering.
     */
    public void operatorControl() 
    {
        myRobot.setSafetyEnabled(false);
        while (isOperatorControl() && isEnabled()) 
        {
            myRobot.arcadeDrive(0.6*stick.getLeftY(), -0.6*stick.getRightX(), true);
            Timer.delay(0.005);		// wait for a motor update time
            runMotor();
        }
    }

    /**
     * Runs during test mode
     */
    public void test() 
    {
    	
    }
}

XBoxJoystick.java:


package org.usfirst.frc.team4528.robot;

import edu.wpi.first.wpilibj.Joystick;

public class XBoxJoystick 
{
	private Joystick joystick;
    private int port;

    private final double DEAD_ZONE = 0.08; // Chief Delphi said 0.05;

    public XBoxJoystick(int port) 
    {
            this.port = port;
            this.joystick = new Joystick(port);
    }

    public double getLeftX() 
    {
            return correctDeadSpot(joystick.getRawAxis(0));
    }

    public double getLeftY() 
    {
            return correctDeadSpot(joystick.getRawAxis(1));
    }

    public double getLeftZ() 
    {
        return joystick.getRawAxis(2);
    }
    
    public double getRightZ() 
    {
        return joystick.getRawAxis(3);
    }

    public double getRightX() 
    {
            return correctDeadSpot(joystick.getRawAxis(4));
    }

    public double getRightY() {
            return correctDeadSpot(joystick.getRawAxis(5));
    }

    public double getDpadX() 
    {
            return joystick.getRawAxis(6);
    }

    // WARNING this doesn't work with vanilla driver station
    public double getDpadY() 
    {
            return joystick.getRawAxis(7);
    }

    public boolean getAButton() 
    {
            return getButton(1);
    }

    public boolean getBButton() 
    {
            return getButton(2);
    }

    public boolean getXButton() 
    {
            return getButton(3);
    }

    public boolean getYButton() 
    {
            return getButton(4);
    }

    public boolean getLBButton() 
    {
            return getButton(5);
    }

    public boolean getRBButton() 
    {
            return getButton(6);
    }

    public boolean getBackButton() 
    {
            return getButton(7);
    }

    public boolean getStartButton() 
    {
            return getButton(8);
    }

    public boolean getLSButton() 
    {
            return getButton(9);
    }

    public boolean getRSButton() 
    {
            return getButton(10);
    }

    private double correctDeadSpot(double value) 
    {
            if (Math.abs(value) < DEAD_ZONE)
                    return 0;
            return value;
    }

    private boolean getButton(int buttonNumber) 
    {
            return joystick.getRawButton(buttonNumber);
    }
}

You never call moveArm() in operatorControl(), which appears (to my tired brain) to be at least some of your issue.

How silly of me to forget. Thank you for pointing it out to me. One more question however. When I did build the code and test it the compressor still ran despite the command for it to start and stay in a closed loop being inside the moveArm() method I did not call, does anyone know why that it?
Thanks in advance.

The compressor is automatically engaged whenever you have instantiated a solenoid.
You don’t need to instantiate the compressor and your Start is redundant.