dasf

Dependencies:   mbed a4988

Fork of Ex_Stepper by YX ZHANG

Revision:
3:46647fcd0269
Parent:
2:c944fc6cdfb7
Child:
4:b371bc40be2a
--- a/main.cpp	Mon Mar 19 03:34:20 2018 +0000
+++ b/main.cpp	Wed May 02 12:53:44 2018 +0000
@@ -1,6 +1,6 @@
 #include "mbed.h"
-
-Ticker ticker_step;
+#include "a4988.h"
+/*Ticker ticker_step;
 DigitalOut step(PB_0), dir(PB_1), en(PC_13);
 volatile int remain;
 
@@ -14,17 +14,24 @@
         step = 1; //STEP 0->1
     }
 }
+*/
 
+Stepper moter(PB_3, PA_6,PA_12);
 int main() {
-    ticker_step.attach(&toggle_step, 0.0002);
-    en = 0; //Enable stepper driver
-    
-    while (true) {
-        dir = 0;
-        remain = 3200;
-        wait(1.5);
-        dir = 1;
-        remain = 3200;
-        wait(1.5);
-    }
+  //  ticker_step.attach(&toggle_step, 0.0002);
+   // en = 0; //Enable stepper driver
+    moter.enable();
+    //while (true) {
+        moter.step(1,5000,3200);
+        //wait(1.5);
+        
+        //moter.step(0,5000,3200);
+        //wait(1.5);
+        //dir = 0;
+        //remain = 3200;
+        //wait(1.5);
+        //dir = 1;
+       // remain = 3200;
+       // wait(1.5);
+   //}
 }