help needed with code for pneumatics

can someone check this over with us? we’re not sure exactly where we need to place the piston, pressure switch, compressor, and solenoids in the digital sidecar.

package org.team640;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.camera.AxisCamera;
import edu.wpi.first.wpilibj.camera.AxisCameraException;
import edu.wpi.first.wpilibj.image.ColorImage;
import edu.wpi.first.wpilibj.image.NIVisionException;

public class armtest extends SimpleRobot {
private final double TARGET_SCORE_THRESHOLD = .01;
public static final double ELBOW_EXTEND_SPEED = 0.2;
public static final double ELBOW_EXTEND_TIME = 5.0;
public static final double WRIST_EXTEND_SPEED = 0.1;
public static final double WRIST_EXTEND_TIME = 2.0;

private RobotDrive robotDrive = new RobotDrive(1,2);
private Jaguar wrist = new Jaguar (3);
private Jaguar elbow = new Jaguar (4);
private Joystick stickLeft = new Joystick(1);
private Joystick stickRight = new Joystick(2);
private Servo cameraTilt = new Servo(3);
private Relay arm = new Relay(3);
private Compressor compressor = new Compressor(1,2);
private Solenoid pistonUp = new Solenoid(5);
private Solenoid pistonDown = new Solenoid(6);
private AxisCamera cam;
private TrackerDashboard trackerDashboard = new TrackerDashboard();

//In this, X represents the relay output number and Y is the joystick port.

public armtest() {
    getWatchdog().setExpiration(0.5);
    initializeTargetting();
    compressor.start();
}

private void processTarget() {
    try {
        System.out.println("Trying to obtain image");
        if (cam.freshImage()) {// && turnController.onTarget()) {
            System.out.println("Have fresh image");
            ColorImage image = cam.getImage();
            Thread.yield();
            Target] targets = Target.findCircularTargets(image);
            Thread.yield();
            image.free();
            if (targets.length <= 100 || targets[10].m_score
                    < TARGET_SCORE_THRESHOLD) //length == 0 (original)
            {
                System.out.println("No target found");
                Target] newTargets = new Target[targets.length + 1];
                newTargets[0] = new Target();
                newTargets[0].m_majorRadius = 10;
                // radius = 0 (original)
                newTargets[0].m_minorRadius = 1;
                newTargets[0].m_score = 2;
                for (int i = 1; i < targets.length; i++) {
                    newTargets* = targets*;
                }
                trackerDashboard.updateVisionDashboard(0.0, 0.0,
                        0.0, 0.0, newTargets);
            } else {
                System.out.println("HAVE TARGET!!!!!");
                System.out.println(targets[0]);
                System.out.println("Target Angle: "
                        + targets[0].getHorizontalAngle());
                trackerDashboard.updateVisionDashboard(0.0, 0.0,
                        0.0, targets[0].m_xPos / targets[0].m_xMax, targets);
            }
        } else {
            System.out.println("No image");
        }
    } catch (NIVisionException ex) {
        ex.printStackTrace();
    } catch (AxisCameraException ex) {
        ex.printStackTrace();
    }
}

private void initializeTargetting() {
    Timer.delay(10.0);
    cam = AxisCamera.getInstance();
    cam.writeResolution(AxisCamera.ResolutionT.k320x240);
    cam.writeBrightness(0);
}

public void operatorControl() {
    getWatchdog().setEnabled(true);
    while (isEnabled() && isOperatorControl()) {
        getWatchdog().feed();
        {    robotDrive.tankDrive(stickLeft, stickRight);
                    if (stickLeft.getTrigger()) {
            arm.set(Relay.Value.kForward);
        } else if (stickRight.getTrigger()) {
            arm.set(Relay.Value.kReverse);
        } else {
            arm.set(Relay.Value.kOff);
        
                        }

//In this, X represents the relay output number and Y is the joystick port.

        if (stickLeft.getTrigger()) {
            elbow.set(ELBOW_EXTEND_SPEED);
            Timer.delay(ELBOW_EXTEND_TIME);
            elbow.set(0);

            wrist.set(WRIST_EXTEND_SPEED);
            Timer.delay(WRIST_EXTEND_TIME);
            wrist.set(0);
        }
        if (stickLeft.getTrigger()) {
            pistonUp.set(true);
        } else if (stickLeft.getRawButton(3)) {
            pistonDown.set(true);
        } else {
            pistonUp.set(false);
            pistonDown.set(false);
        }
        if (stickLeft.getTrigger()) {
            cameraTilt.set(1.0);
        } else {
            cameraTilt.set(0.5);
        }
    }
}

}
}**

First off, you should really be asking the person who wrote the code. They should be on your team, and it’s their responsibility to provide the team with documentation.

With that said, I’ll help you out.

private Compressor compressor = new Compressor(1,2);
private Solenoid pistonUp = new Solenoid(5);
private Solenoid pistonDown = new Solenoid(6);

Is what you’re looking for.

private Compressor compressor = new Compressor(1,2);

Means that the pressure sensor should be plugged into Digital IO 1, and the 3-pin cable for the compressor’s spike should be plugged into Relay 2.

private Solenoid pistonUp = new Solenoid(5);
private Solenoid pistonDown = new Solenoid(6);

Means that your up piston solenoid should be plugged into port 5 on the analog breakout module (NOT the digital sidecar), and your down piston solenoid should be plugged into port 6 on the same module.