This is the third day I have been at this (working on pneumatics).
Now the compressor is attached to a spike, then the spike is connected to the power distribution board both 20amp breakers. The spike is connected to the digital sidecar in relay slot 1 (sig [a], pow**, ground-]). And the pressure switch is connected to Digital I/O 1 (Black on Nc, Red on C).
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Watchdog;
public class RobotTemplate extends SimpleRobot {
private static final long TIME_DELAY = 1000; //in milliseconds
Joystick leftStick = new Joystick(1);
Joystick rightStick = new Joystick(2);
Joystick three = new Joystick(3);
Jaguar rightF = new Jaguar(2);
Jaguar rightB = new Jaguar(1);
Jaguar leftF = new Jaguar(3);
public Jaguar leftB = new Jaguar(4);
public Compressor fluffy = new Compressor(1, 1, 1, 1);
DriverStation ds;
Watchdog fenrir = Watchdog.getInstance();
void drive() {
if (leftStick.getRawButton(1)) {
leftF.set(-1.0);
rightB.set(1.0);
leftB.set(1.0);
rightF.set(-1.0);
} else {
if (rightStick.getRawButton(1)) {
leftF.set(1.0);
rightB.set(-1.0);
leftB.set(-1.0);
rightF.set(1.0);
} else {
leftF.set(leftStick.getY());
rightB.set(rightStick.getY() * -1);
leftB.set(leftStick.getY());
rightF.set(rightStick.getY() * -1);
}
}
}
void com() {
fenrir.feed();
if (fluffy.getPressureSwitchValue()) {
fluffy.setRelayValue(Relay.Value.kOff);
} else {
fluffy.setRelayValue(Relay.Value.kOn);
}
}
public void autonomous() {
fenrir.feed();
}
public void operatorControl() {
while (true && isOperatorControl() && isEnabled()) {
fenrir.feed();
com();
drive();
}
}
}
Here is he code I went over a ton of times and can’t see anything wrong with it. Help please.
I know its also in the pneumatic’s thread but more people are viewing this thread.**