View Single Post
  #13   Spotlight this post!  
Unread 18-02-2010, 18:37
kennypu kennypu is offline
Registered User
FRC #2467
 
Join Date: Jan 2010
Location: Hawaii
Posts: 40
kennypu is an unknown quantity at this point
Re: Compressor won't start

Quote:
Originally Posted by 1075guy View Post
The compressor WILL NOT RUN without the pressure switch connected, this is because the switch is a normally closed contact, that goes open when its reached pressure.

The code you showed shows Digital In 4 as where its expecting the switch, and Relay 2 as where its outputting the signals. The LEDs on the sidecar near the relay ports will switch when its working.

Also, I highly recommend using pointers instead of directly instantiating your objects:

Code:
class myRobot : public SimpleRobot 
{
RobotDrive* driveBase;
Jaguar* someMotor;
Solenoid* someSolenoid;
Compressor* theCompressor;

myRobot(){
driveBase = new RobotDrive(1,2,3,4);
someMotor = new Jaguar(5);
someSolenoid = new Solenoid(1);
theCompressor = new Compressor(1,1);
theCompressor->Start();
}

void Teleop(){
someMotor->Set(1);
}

};
This way, you can pass them by reference, instead of by value, which breaks things. Its good practice.
Thanks 1075guy!!!! for some odd reason, using the pointers made it work o.o. Now off to work the solenoids...
Reply With Quote