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: Stepp.cpp
- Revision:
- 1:ef18c260ce02
- Parent:
- 0:7cedfb720712
- Child:
- 2:835c883d81b0
diff -r 7cedfb720712 -r ef18c260ce02 Stepp.cpp --- a/Stepp.cpp Wed Jun 07 13:31:02 2017 +0000 +++ b/Stepp.cpp Mon Sep 18 13:05:47 2017 +0000 @@ -46,28 +46,30 @@ _en = 0; // habilita move _dir = direction; - while(sensor.read() == 0 && EixoMonitoring::stopAll == false){ // n chegou na origem - - if(this->acell){ //linear acceleration - if(i < START_STOP_SPEED) if (--accelspeed == this->speed) accelspeed ++; - if(i > (n_steps-START_STOP_SPEED)) if(++accelspeed == START_STOP_SPEED) accelspeed--; - } - - _clk = 1; - wait_us(1); - _clk = 0; - wait_us(1); - wait_us(accelspeed); - - i++; + while(sensor.read() == 0 && EixoMonitoring::stopAll == false){ // n chegou na origem + + if(this->acell){ //linear acceleration + if(i < START_STOP_SPEED) if (--accelspeed == this->speed) accelspeed ++; + if(i > (n_steps-START_STOP_SPEED)) if(++accelspeed == START_STOP_SPEED) accelspeed--; + } + + _clk = 1; + wait_us(1); + _clk = 0; + wait_us(1); + wait_us(accelspeed); + + i++; } _en = 1; - if(sensor.read() == 0){ - return 0; - } - else return 1; + if(sensor.read() == 0){ + return 0; + } + else{ + return 1; + } }