dsaf
Fork of a4998 by
Diff: a4988.cpp
- Revision:
- 1:ab0f997c2d9c
- Parent:
- 0:173936452e07
diff -r 173936452e07 -r ab0f997c2d9c a4988.cpp --- a/a4988.cpp Wed May 02 10:48:23 2018 +0000 +++ b/a4988.cpp Tue May 08 01:19:00 2018 +0000 @@ -1,6 +1,7 @@ #include "a4988.h" #include "mbed.h" -Stepper::Stepper(PinName _en, PinName _stepPin, PinName _direction):en(_en), +Stepper::Stepper(PinName _en, PinName _stepPin, PinName _direction): + en(_en), stepPin(_stepPin), direction(_direction) { @@ -34,12 +35,10 @@ if(remain == 0) { return; + }else if(stepPin){ + stepPin = 0; //STEP 1->0 + remain--; + }else{ + stepPin = 1; //STEP 0->1 } - - if(stepPin){ - stepPin = 0; //STEP 1->0 - remain--; - }else{ - stepPin = 1; //STEP 0->1 - } }