Keegan Hu
/
Ex_Stepper
dasf
Fork of Ex_Stepper by
main.cpp@4:b371bc40be2a, 2018-05-05 (annotated)
- Committer:
- glintligo
- Date:
- Sat May 05 14:11:13 2018 +0000
- Revision:
- 4:b371bc40be2a
- Parent:
- 3:46647fcd0269
- Child:
- 5:4219a5c6afc1
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
zhangyx | 0:19f886d481f3 | 1 | #include "mbed.h" |
glintligo | 3:46647fcd0269 | 2 | #include "a4988.h" |
glintligo | 4:b371bc40be2a | 3 | |
zhangyx | 0:19f886d481f3 | 4 | |
glintligo | 4:b371bc40be2a | 5 | // en step dir |
glintligo | 4:b371bc40be2a | 6 | Stepper moter(PB_3, PA_6, PA_12);//实例化一个步进电机对象 |
zhangyx | 0:19f886d481f3 | 7 | int main() { |
glintligo | 4:b371bc40be2a | 8 | |
glintligo | 4:b371bc40be2a | 9 | moter.enable();//启动步进电机 |
glintligo | 4:b371bc40be2a | 10 | moter.step(1,5000,3200);// 1表示正转0表示反转 5000hz脉冲周期 转3200个脉冲 |
glintligo | 4:b371bc40be2a | 11 | moter.enable();//关闭步进电机电机 |
glintligo | 4:b371bc40be2a | 12 | while(1) |
glintligo | 4:b371bc40be2a | 13 | { |
glintligo | 4:b371bc40be2a | 14 | } |
zhangyx | 0:19f886d481f3 | 15 | } |