If you use the PCM right, you never have to write any code. There should be a spot for your pressure sensor, and one for your compressor (and a bunch for your solenoids, but you have to get there first

). Once you call Compressor.start() (or your languages local equivalent), the PCM will send power to the compressor until your pressure sensor reads as a full 120psi wherever it is in your pneumatic loop, and then shut off. It will automatically turn on the compressor once it dips below 120 again.