This is a remote control tester, it uses a CNC, Ethernet Communication with a JAVAFX interface and a PLC in order to control some valves.

Dependencies:   EthernetInterface mbed-rtos mbed

Fork of CNC_CONTROLLER by Lahis Almeida

Cnc.cpp

Committer:
kevencastro7
Date:
2017-12-15
Revision:
2:835c883d81b0

File content as of revision 2:835c883d81b0:

#include "Cnc.h"
#define DELAY 0.075

Cnc::Cnc(EixoController* eixoX, EixoController* eixoY, PinName pinValve, PCF8574* pcf, int sensorUp, int sensorDown) : eixoZ(pinValve) {
    this->eixoX = eixoX;
    this->eixoY = eixoY;
    this->pcf = pcf;
    this->sensorUp = sensorUp;
    this->sensorDown = sensorDown;
    debug = new Debug();      
}

void Cnc::goToPosition(float posX, int dirX, float posY, int dirY, bool enable){
    eixoX->goToPosition(posX, dirX);
    eixoY->goToPosition(posY, dirY);
    /*if (enable){
        while(!pcf->read(sensorDown))eixoZ = 1;
        eixoZ = 0;
    }*/
        if (enable){
        eixoZ = 1;
        wait(DELAY);
        eixoZ = 0;
    }
}