yuto kawamura
/
MR2_n_1_class
l
pin.h@6:75cfa1a66382, 2019-04-27 (annotated)
- Committer:
- yuto17320508
- Date:
- Sat Apr 27 11:22:00 2019 +0000
- Revision:
- 6:75cfa1a66382
- Parent:
- 5:1fa5aa097af5
l
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
eri | 3:df0c9883e403 | 1 | #include "mbed.h" |
eri | 3:df0c9883e403 | 2 | #include "EC.h" |
eri | 3:df0c9883e403 | 3 | |
eri | 3:df0c9883e403 | 4 | Serial pc(USBTX,USBRX); |
eri | 3:df0c9883e403 | 5 | |
eri | 3:df0c9883e403 | 6 | int resolution = 1000; //エンコーダの分解能×逓倍 |
eri | 3:df0c9883e403 | 7 | |
eri | 3:df0c9883e403 | 8 | //ピン宣言 |
eri | 3:df0c9883e403 | 9 | PwmOut motor_r_f(p21); //モータ正転 |
eri | 3:df0c9883e403 | 10 | PwmOut motor_r_b(p22); //モータ逆転 |
yuto17320508 | 6:75cfa1a66382 | 11 | //PwmOut motor_l_f(p25); //モータ正転 |
yuto17320508 | 6:75cfa1a66382 | 12 | //PwmOut motor_l_b(p26); //モータ逆転 |
yuto17320508 | 6:75cfa1a66382 | 13 | PwmOut motor_l_f(p23); //モータ正転 |
yuto17320508 | 6:75cfa1a66382 | 14 | PwmOut motor_l_b(p24); //モータ逆転 |
eri | 3:df0c9883e403 | 15 | DigitalIn switch_max(p9); //直動機構の上限のリミットスイッチ |
eri | 3:df0c9883e403 | 16 | DigitalIn switch_min(p8); //直動機構の下限のリミットスイッチ |
eri | 3:df0c9883e403 | 17 | DigitalIn switch_x(p7); //X脚の接地を判定するスイッチ(今後実装予定) |
eri | 3:df0c9883e403 | 18 | DigitalIn switch_y(p5); //Y脚の接地を判定するスイッチ(今後実装予定) |
eri | 3:df0c9883e403 | 19 | DigitalIn switch_hand(p6); //ゲルゲ回収アームのスイッチ |
eri | 3:df0c9883e403 | 20 | |
eri | 3:df0c9883e403 | 21 | |
eri | 3:df0c9883e403 | 22 | //シリンダーの配列の番号 |
eri | 3:df0c9883e403 | 23 | #define r_o_s 0 // right_outside_short |
eri | 3:df0c9883e403 | 24 | #define r_i_s 1 // right_inside_short |
eri | 3:df0c9883e403 | 25 | #define l_i_s 2 |
eri | 3:df0c9883e403 | 26 | #define l_o_s 3 |
eri | 3:df0c9883e403 | 27 | #define long_o 4 // long_outside |
eri | 3:df0c9883e403 | 28 | #define long_i 5 //long_inside |
eri | 3:df0c9883e403 | 29 | /*#define r_o_l 4 |
eri | 3:df0c9883e403 | 30 | #define r_i_l 5 |
eri | 3:df0c9883e403 | 31 | #define l_i_l 6 |
eri | 3:df0c9883e403 | 32 | #define l_o_l 7*/ |
eri | 3:df0c9883e403 | 33 | |
eri | 3:df0c9883e403 | 34 | DigitalOut air[] = { |
eri | 3:df0c9883e403 | 35 | DigitalOut(p15), |
eri | 3:df0c9883e403 | 36 | DigitalOut(p16), |
eri | 3:df0c9883e403 | 37 | DigitalOut(p17), |
eri | 3:df0c9883e403 | 38 | DigitalOut(p18), |
yuto17320508 | 5:1fa5aa097af5 | 39 | DigitalOut(p7), |
yuto17320508 | 5:1fa5aa097af5 | 40 | //DigitalOut(p20) |
yuto17320508 | 5:1fa5aa097af5 | 41 | DigitalOut(p5) |
eri | 3:df0c9883e403 | 42 | }; |
eri | 3:df0c9883e403 | 43 | |
eri | 3:df0c9883e403 | 44 | |
eri | 3:df0c9883e403 | 45 | |
eri | 3:df0c9883e403 | 46 | DigitalOut hand(p19); //ゲルゲ回収アームのハンド部開閉 |
eri | 3:df0c9883e403 | 47 | DigitalOut gerege(p20); //ゲルゲ持ち上げ機構 |
yuto17320508 | 5:1fa5aa097af5 | 48 | Ec ec_l(p23,p24,NC,resolution,0.01); //エンコーダ右 外側前→正 外側の位置 |
yuto17320508 | 5:1fa5aa097af5 | 49 | Ec ec_r(p10,p12,NC,resolution,0.01); //エンコーダ左 外側前→正 外側の位置 |
eri | 3:df0c9883e403 | 50 | HCSR04 sensor(p30, p29); |
eri | 3:df0c9883e403 | 51 | KondoServo servo(p28,p27,1,115200); //旋回用のシリアルサーボ |