Hey, thanks to some great help from Jon236, Alan Anderson and Mark McLeod, I think I got some code that *might* work with the pneumatics system...
If someone could take a look over it and maybe give me some pointers, that'd be great! (School is closed until Tuesday...Furlough days.

)
Code:
#include "WPILib.h"
#include "1771Constants.h"
#include <iostream>
using namespace std;
namespace Team1771
{
class Team1771Robot : public SimpleRobot
{
RobotDrive driveTrain;
Joystick leftStick;
Joystick rightStick;
Joystick manipulator;
Compressor compressorControl;
Solenoid turret;
public:
Team1771Robot(void):
driveTrain(LEFT_DRIVE_MOTOR_PORT,
RIGHT_DRIVE_MOTOR_PORT),
leftStick(LEFT_JOYSTICK_PORT),
rightStick(RIGHT_JOYSTICK_PORT),
manipulator(MANIPULATOR_JOYSTICK_PORT),
compressorControl(3,3,COMPRESSOR_PORT,7),
turret(5) //THIS *HAS* TO BE CHANGED
//I just made up random number
//TODO: Figure out how to hook it up!!!
{
compressorControl.Start();
};
void Autonomous(void)
{
GetWatchdog().SetEnabled(false);
while(IsAutonomous() && !IsDisabled())
{}
}
void OperatorControl(void)
{
GetWatchdog().SetEnabled(false);
while (IsOperatorControl() && !IsDisabled())
{
//FIRE AWAY CAP'N!
if(manipulator.GetRawButton(1))
{
//Seeing if I have enough. Just a rough estimate.
if(compressorControl.GetPressureSwitchValue() < 100)
{
cout << "Not enough power to fire. " << endl;
cout << compressorControl.GetPressureSwitchValue() << endl;
Wait(1);
}
else //Fire into the crowd! Rawr!
{
//Uncomment to see pressure values before firing
/*
cout << compressorControl.GetPressureSwitchValue() << endl;
*/
turret.Set(1); //I think this will tell the solenoid(I think its the solenoid?)
//to switch and let the air fire from the chamber.
turret.Set(0);//Then that should turn it off?
//TODO: Figure out if 1 is letting air in, or if 0 is.
//Uncomment this below for seeing how much pressure we lose from firing.
/*
cout << compressorControl.GetPressureSwitchValue() << endl;
*/
Wait(1);
}
}
}
}
};
START_ROBOT_CLASS(Team1771Robot);
}
One of my questions that I already have however, is with the Compressor.Start()
I noticed in the Compressor.h file, there is a function called void SetRelayValue(Relay::Value relayValue). Does the Compressor class automatically call this is needed?
From what I understand, calling compressorControl.Start() will turn on the compressor, and automatically keep the pressure to a certain level.