c++ pcm

I was wondering… does anyone know how to code the pcm in c++? how do you set the psi?

thanks for your help!

You do not set the PSI in code. It is set by the switch (about 117 psi), which you cannot change (legally). The Pressure Relief Valve can, and should, be set to the proper psi (around 120 to 125 psi).

You can enable and disable the compressor in code, but you cannot set the PSI.

The PSI is set manually using the required pressure regulator (R78 D in rulebook). If you mean just the compressor, the PCM automatically runs when you use the DoubleSolenoid Class.

The API is described here:

http://first.wpi.edu/FRC/roborio/release/docs/cpp/classPCM.html

thanks… its been a long day and one of my fellow programmers told me to check… its hard to think when you are tired…

That link is for an internal class that generally is not used directly.

jthenderson,
If you want to use the solenoid outputs on the PCM, just create Solenoid or DoubleSolenoid objects.

If you want the PCM to auto-enable the compressor when your system needs air, just wire the pressure-switch and compressor to the PCM. The software will know what to do as long as you created as least one Solenoid/Double Solenoid.

If you want advance features like getting the solenoid voltage (to confirm the solenoid jumper is in 12V or 24V mode), getting compressor current, or getting/clearing fault flags, you can create a Compressor object. Also you can use SetClosedLoopControl() to force-off the compressor if you want. Some teams will force the compressor off for power management.

There is no need to create a PCM object,
https://wpilib.screenstepslive.com/s/4485/m/13810/l/241865?data-resolve-url=true&data-manual-id=13810
https://wpilib.screenstepslive.com/s/4485/m/13810/l/241866?data-resolve-url=true&data-manual-id=13810