The Compressor class will manage everything to do with the running the compressor and turning it on/off based on the pressure switch. You just have to pass it the slot/channel of the spike relay and the pressure switch and call Start(). You will use the Selenoid class to control your solenoid. It has a Set() function to turn it on/off. Below is a simple example but it will need a little more work before it is functional. First you need to set the proper channel/slot values. I just put zeros in so you must put the correct values here for it to work. Also, I just guessed that to open your grabber you would turn your selenoid off and to close it you would turn your selenoid on. Good Luck!!
Grabber.h
Code:
#include "Compressor.h"
#include "Solenoid.h"
class Grabber
{
public:
Grabber();
~Grabber();
void Open();
void Close();
private:
Compressor* pCompressor;
Solenoid* pSolenoid;
};
Grabber.cpp
Code:
#include "Grabber.h"
Grabber::Grabber()
{
this->pCompressor = new Compressor(0,0,0,0);
this->pSolenoid = new Solenoid(0,0);
this->pCompressor->Start();
this->pSolenoid->Set(false);
}
Grabber::~Grabber()
{
}
void Grabber::Open()
{
this->pSolenoid->Set(false);
}
void Grabber::Close()
{
this->pSolenoid->Set(true);
}