![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
dasf
Fork of Ex_Stepper by
Diff: main.cpp
- Revision:
- 5:4219a5c6afc1
- Parent:
- 4:b371bc40be2a
- Child:
- 6:f86c43194362
diff -r b371bc40be2a -r 4219a5c6afc1 main.cpp --- a/main.cpp Sat May 05 14:11:13 2018 +0000 +++ b/main.cpp Tue Jul 17 00:29:06 2018 +0000 @@ -1,15 +1,15 @@ #include "mbed.h" #include "a4988.h" +// en step dir +Stepper moter(PB_3, PA_6, PA_12); //实例化一个步进电机对象 +int main() +{ -// en step dir -Stepper moter(PB_3, PA_6, PA_12);//实例化一个步进电机对象 -int main() { - - moter.enable();//启动步进电机 - moter.step(1,5000,3200);// 1表示正转0表示反转 5000hz脉冲周期 转3200个脉冲 - moter.enable();//关闭步进电机电机 - while(1) + moter.enable(); //启动步进电机 + moter.step(1, 5000, 3200); // 1表示正转0表示反转 5000hz脉冲周期 转3200个脉冲 + moter.disable(); //关闭步进电机电机 + while (1) { - } + } }