Thge compressor has its own class in wpi lib, so you don't have to create a relay for it. Instead you make it a compressor object and construct it with the pressure switch port and the relay port.
so...
Code:
class
RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick leftjoy;
Joystick rightjoy;
Joystick armjoy;
Jaguar arm;
Relay piston;
Compressor robot_compressor; // This will handle the compressor
DigitalInput limitswitch_foward;
DigitalInput limitswitch_reverse;
Servo x_axis;
Servo y_axis;
myRobot(1, 2),
leftjoy(1),
rightjoy(2),
armjoy(3),
arm(3),
piston(4),
robot_compressor(pressure switch channel, relay channel);//obviously sub in the ports that you are using
void OperatorControl(void)
{
GetWatchdog().SetExpiration(1.00);
robot_compressor.start();// to start the compressor
robot_compressor.stop();//to stop the compressor
}
I also moved where the GetWatchdog.SetExperation I think it just got pasted into the wrong spot (it was above the operator control function)