StepperMotor class lib simple sample

Dependencies:   mbed StepperMotor

Components pages

Components pages are available for bipolar and unipolar motor libraries

A bipolar stepper motor driving pulse generator

A unipolar stepper motor driving pulse generator

Files at this revision

API Documentation at this revision

Comitter:
okano
Date:
Thu Nov 25 11:18:21 2010 +0000
Child:
1:7ae2ba4231d5
Commit message:

Changed in this revision

StepperMotor.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/StepperMotor.lib	Thu Nov 25 11:18:21 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/okano/code/StepperMotor/#dc6cf8f8bcb7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 25 11:18:21 2010 +0000
@@ -0,0 +1,37 @@
+#include "mbed.h"
+#include "StepperMotor.h"
+
+BusOut          leds( LED4, LED3, LED2, LED1 );
+StepperMotor    m( p21, p22, p23, p24 );
+
+int main() {
+    m.set_sync_mode( StepperMotor::SYNCHRONOUS );
+    m.set_power_ctrl( true );
+
+    while ( 1 ) {
+    
+        leds    = 1;
+        m.go_angle( 120 );
+        wait( 0.5 );
+
+        leds    = 2;
+        m.go_angle( 240 );
+        wait( 0.5 );
+
+        leds    = 3;
+        m.go_angle( 0 );
+        wait( 0.5 );
+
+        leds    = 4;
+        m.go_angle( 240 );
+        wait( 0.5 );
+
+        leds    = 5;
+        m.go_angle( 120 );
+        wait( 0.5 );
+
+        leds    = 6;
+        m.go_angle( 0 );
+        wait( 0.5 );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 25 11:18:21 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e