There is a new version of WPILib that will automatically operate the compressor if connected in the background. You need to call:
Code:
InitPressureSwitch(unsigned char pressureSwitchPort, unsigned char relayPort)
Call the function only once from your Initialize function and WPILib will start checking the status of the pressure switch every 500ms and operate the compressor when needed. The compressor should be connected to a spike connected to the specified relay port.
You can pick up the new version from the
WPILib web site.
Enjoy...