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