Your sample code states the compressor is digital i/o 4, and relay 2, you say you are using relay 3; is that your issue?
Try calling compressor->Start() in your teleop/autonomous loop.
The code you presented is fine otherwise, though I would opt to directly instance compressor, rather than allocating it dynamically, but it's a point of preference. I also prefer to derive from IterativeRobot instead of SimpleRobot
Code:
class Robot2012 : public IterativeRobot
{
Compressor compressor;
public:
Robot2012(void):compressor(DIGITAL_CHANNEL_1_INPUT_COMPRESSOR_SWITCH, RELAY_CHANNEL_1_COMPRESSOR_RELAY)
{
}
void DisabledInit(void)
{
compressor.Stop();
}
void AutonomousInit(void)
{
compressor.Start();
}
void TeleopInit(void)
{
compressor.Start();
}
Here's a link to my 2012 code:
https://github.com/TeamExcel/Project.../Robot2012.cpp