Didn't solve the problem, here is the simpler version of the code that we are starting all over from the begining (without messing with relay in the program):
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Joystick;
public class RobotTemplate extends SimpleRobot {
private Joystick Stick = new Joystick(1);
private Compressor compressor = new Compressor(2,2);
private Solenoid pistonUP = new Solenoid(1);
private Solenoid pistonDOWN = new Solenoid(2);
public RobotTemplate(){
getWatchdog().setExpiration(0.5);
compressor.start();
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
getWatchdog().setEnabled(true);
while(isEnabled() && isOperatorControl()){
getWatchdog().feed();
if(Stick.getTrigger()){
pistonUP.set(true);
}else if(Stick.getRawButton(3)){
pistonDOWN.set(true);
}else{
pistonUP.set(false);
pistonDOWN.set(false);
}
}
}
/**
* This function is called once each time the robot enters test mode.
*/
public void test() {
}
}
