Auto off air compressior code

Hello I was just wondering where to find the code that automatically. turns off the air compressor. Thank you

WPIlib in LabVIEW has a set of blocks to open, start, stop, and close the Compressor. When you open a compressor, you set the slot and port of the compressor AND the pressure switch. The set of blocks for the compressor will automatically handle the pressure switch for you. If you aren’t using LabVIEW, the code associated for the compressor will automatically handle the pressure switch.

Is there a C++ lib for this also?

It should automatically handle the switch I guess.

In C++ and Java, after you create a compressor object and call its start method it will automatically turn the compressor on and off as needed.

You need to make sure you have the pressure switch wired up to a digital input correctly and that you specify the correct spike relay and digital input for the pressure switch when you create the object.

Thank you for your post and I found it is the 2005 code

relay8_fwd = !rc_dig_in18; /* Power pump only if pressure switch is off. */
relay8_rev = 0;

Thank you for your support

In 2005 the code needed a single line of code:


  relay8_fwd = !rc_dig_in18;  /* Power pump only if pressure switch is off. */

The pressure switch connects to Digital Input 18
The Spike for the compressor is controlled by Relay 8

Ok now how can I change when the pump turns on and off

Whatever you want to do:

relay8_rev = 0; /* stays this way and doesn’t change */

relay8_fwd = 1 /* Turns the compressor on */

relay8_fwd = 0 /* Turns the compressor off */

This is all very useful stuff. Thanks!

word of warning: 2005 code WONT work on your cRIOs. it was written under a MUCH different system, with completely different interfacing to the relays (Spikes) and motor controllers (jaguar/victor)