Operating a compressor for pneumatics
The Compressor class is designed to operate any FRC supplied compressor on the robot. A Compressor object is constructed with 2 input/output ports:
• The Digital Relay output port connected to the Spike relay that controls the power to the compressor. (A digital output or Solenoid module port alone doesn’t supply enough current to operate the compressor.)
• The Digital input port connected to the pressure switch that monitors the accumulator pressure.
The Compressor class will automatically create a task that runs in the background and twice a second turns the compressor on or off based on the pressure switch value. If the system pressure is above the high set point of the switch, the compressor turns off. If the pressure is below the low set point, the compressor turns on.
Starting the compressor
To use the Compressor class create an instance of the Compressor object and use the Start() method. This is typically done in the constructor for your Robot Program. Once started, it will continue to run on its own with no further programming necessary. If you do have an application where the compressor should be turned off, possibly during some particular phase of the game play, you can stop and restart the compressor using the Stop() and Start() methods.
The compressor class will create instances of the DigitalInput and Relay objects internally to read the pressure switch and operate the Spike relay.
Shown in the example is some C++ code that implements a compressor with a Spike relay connected to Relay port 2 and the pressure switch connected to digital input port 4. Both of these ports are connected to the primary digital input module.