A simple stepper motor control demo.
Dependencies: StepperController mbed
Revision 0:caaeeae63fcb, committed 2018-04-13
- Comitter:
- acracan
- Date:
- Fri Apr 13 06:20:11 2018 +0000
- Commit message:
- A simple stepper control demo.
Changed in this revision
diff -r 000000000000 -r caaeeae63fcb StepperController.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StepperController.lib Fri Apr 13 06:20:11 2018 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/SavinescuStefan/code/StepperController/#2cfd64d210f3
diff -r 000000000000 -r caaeeae63fcb main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 13 06:20:11 2018 +0000 @@ -0,0 +1,19 @@ +#include "mbed.h" +#include "steppercontroller.h" + +StepperController stepper(D7, D6, D5, D4); +Timer stepperTimer; + +int main() +{ + stepper.setPeriod(50.0e-6f); + stepper.setPulseWidth(0.1f); + stepper.setDirection(StepperController::DirectionCW); + stepperTimer.start(); + while (1) { + if (stepperTimer.read() > 1.0f) { + stepperTimer.reset(); + stepper.advance(); + } + } +} \ No newline at end of file
diff -r 000000000000 -r caaeeae63fcb mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Apr 13 06:20:11 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/994bdf8177cb \ No newline at end of file