A simple stepper motor control demo.

Dependencies:   StepperController mbed

Files at this revision

API Documentation at this revision

Comitter:
acracan
Date:
Fri Apr 13 06:20:11 2018 +0000
Commit message:
A simple stepper control demo.

Changed in this revision

StepperController.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
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