
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
Diff: EixoController.cpp
- Revision:
- 2:835c883d81b0
- Parent:
- 1:ef18c260ce02
--- a/EixoController.cpp Mon Sep 18 13:05:47 2017 +0000 +++ b/EixoController.cpp Fri Dec 15 19:40:41 2017 +0000 @@ -1,22 +1,23 @@ #include "EixoController.h" -EixoController::EixoController(float totalPathPulse, float totalPathCm, Stepp *motor, PinName pinOrigin, PinName pinEnd): swOrigin(pinOrigin), swEnd(pinEnd) { - +EixoController::EixoController(float totalPathPulse, float totalPathCm, Stepp *motor,PCF8574 *pcf, int swOrigin, int swEnd){ + this->pcf = pcf; this->totalPathPulse = totalPathPulse; this->totalPathCm = totalPathCm; this->motor = motor; - - debug = new Debug(); + this->swOrigin = swOrigin; + this->swEnd = swEnd; + debug = new Debug(); } -bool EixoController:: goToOrigem(DigitalIn swOrigem, int dirOrigem){ - if(swOrigem == 1){ // já está na origem ? +bool EixoController:: goToOrigem(int dirOrigem){ + if(this->pcf->read(this->swOrigin) == 1){ // já está na origem ? return true; } else{ // vá para a origem - return motor->findLimits(30000, dirOrigem, swOrigem); + return motor->findLimits(30000, dirOrigem, this->pcf,this->swOrigin); } }