Final version of stepper motor demo

Dependencies:   Stepper_Motor_X27168 mbed

Fork of Stepper_Motor_Demo by Hanbin Ying

Revision:
1:5de876de6423
Parent:
0:71dc3ae7e2eb
Child:
2:5c8e6d22f773
--- a/main.cpp	Tue Oct 20 00:41:08 2015 +0000
+++ b/main.cpp	Wed Mar 16 18:05:40 2016 +0000
@@ -2,18 +2,31 @@
 #include "StepperMotor_X27168.h"
 
 StepperMotor_X27168 smotor(p25, p26, p23, p22);
-
 int main() {
 
-    smotor.step_position(180);
-    wait(0.5);
+    smotor.init(); //initialize the motor
     
-    smotor.step_position(100);
-    wait(0.5);
+    smotor.set_speed(500); //set the speed to 500 steps per second
+    
+    smotor.angle_position(45);
+    wait(1);
     
     smotor.angle_position(270);
-    wait(0.5);
+    wait(1);
+    
+    smotor.angle_position(90);
+    wait(1);
+    
+    smotor.angle_position(180);
+    wait(1);
     
-    smotor.step_position(0);
-    wait(0.5);
+    smotor.angle_position(315);
+    wait(1);
+    
+    smotor.angle_position(45);
+    wait(1);
+    
+    smotor.angle_position(0);
+    wait(1);
+    
 }