Keegan Hu
/
finalwarehouse
ddd
Fork of whouse by
main.cpp@2:ecf401a37aa3, 2018-05-11 (annotated)
- Committer:
- glintligo
- Date:
- Fri May 11 10:25:12 2018 +0000
- Revision:
- 2:ecf401a37aa3
- Parent:
- 0:2e00b81c9137
- Child:
- 3:09f6061e6e5d
test1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bilybill | 0:2e00b81c9137 | 1 | #include "mbed.h" |
Bilybill | 0:2e00b81c9137 | 2 | #include "Stepper_motor.h" |
Bilybill | 0:2e00b81c9137 | 3 | #include "robo.h" |
Bilybill | 0:2e00b81c9137 | 4 | Serial Info(PB_10,PB_11); |
Bilybill | 0:2e00b81c9137 | 5 | Ticker t1; |
glintligo | 2:ecf401a37aa3 | 6 | /*Stepper_motor s1(PB_9,PB_0,PB_7,PA_11,10,16,1); |
Bilybill | 0:2e00b81c9137 | 7 | Stepper_motor s2(PB_6,PA_7,PB_4,PA_15,10,16,1); |
Bilybill | 0:2e00b81c9137 | 8 | Stepper_motor s3(PB_3,PA_6,PA_12,PB_1,10,16,1); |
glintligo | 2:ecf401a37aa3 | 9 | */ |
glintligo | 2:ecf401a37aa3 | 10 | // en step dir button 减速比 细分数 初始方向 |
glintligo | 2:ecf401a37aa3 | 11 | Stepper_motor s1(PA_6,PC_5,PC_4,PB_14,10,16,0);//x |
glintligo | 2:ecf401a37aa3 | 12 | Stepper_motor s2(PA_2,PA_5,PA_4,PC_6,10,16,1);//y |
glintligo | 2:ecf401a37aa3 | 13 | Stepper_motor s3(PC_13,PC_3,PC_2,PB_15,10,16,0);//z |
glintligo | 2:ecf401a37aa3 | 14 | PwmOut pwm2(PA_1); |
glintligo | 2:ecf401a37aa3 | 15 | DigitalOut button(PA_0); |
glintligo | 2:ecf401a37aa3 | 16 | |
Bilybill | 0:2e00b81c9137 | 17 | int main() |
Bilybill | 0:2e00b81c9137 | 18 | { |
glintligo | 2:ecf401a37aa3 | 19 | pwm2.period_ms(1); |
glintligo | 2:ecf401a37aa3 | 20 | pwm2.pulsewidth_us(500); |
glintligo | 2:ecf401a37aa3 | 21 | /*s1.Init(); |
glintligo | 2:ecf401a37aa3 | 22 | wait(5); |
Bilybill | 0:2e00b81c9137 | 23 | s2.Init(); |
glintligo | 2:ecf401a37aa3 | 24 | wait(5); |
Bilybill | 0:2e00b81c9137 | 25 | s3.Init();//电机初始化 |
glintligo | 2:ecf401a37aa3 | 26 | wait(5); |
glintligo | 2:ecf401a37aa3 | 27 | s3.Config(5,-90); |
glintligo | 2:ecf401a37aa3 | 28 | */ |
glintligo | 2:ecf401a37aa3 | 29 | while(1) |
glintligo | 2:ecf401a37aa3 | 30 | { |
glintligo | 2:ecf401a37aa3 | 31 | |
glintligo | 2:ecf401a37aa3 | 32 | button = 0; |
glintligo | 2:ecf401a37aa3 | 33 | wait(5); |
glintligo | 2:ecf401a37aa3 | 34 | button = 1; |
glintligo | 2:ecf401a37aa3 | 35 | //pwm2.pulsewidth_us(1000); |
glintligo | 2:ecf401a37aa3 | 36 | wait(5); |
glintligo | 2:ecf401a37aa3 | 37 | } |
Bilybill | 0:2e00b81c9137 | 38 | } |