StepperMotor class lib simple sample
Dependencies: mbed StepperMotor
Components pages
Components pages are available for bipolar and unipolar motor libraries
Revision 0:9fdf81f6f8e9, committed 2010-11-25
- Comitter:
- okano
- Date:
- Thu Nov 25 11:18:21 2010 +0000
- Child:
- 1:7ae2ba4231d5
- Commit message:
Changed in this revision
--- /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