The
Compressor class takes care of all the logic for you. All you need to do is create a Compressor object with the proper Relay and Digital I/O pins specified, and tell it to start.
Code:
Compressor *myCompressor = new Compressor(1, 5);
myCompressor->Start();
It will turn on and off all by itself after that.
The pressure switch is a simple SPST switch. It does not matter which side of the connection is which. One side goes to a black "ground" wire on a Digital I/O, and the other side goes to a white "signal" wire. The red "+5" wire should not be connected, and for safety the end of it should be wrapped in electrical tape to prevent it from touching anything.