基本クラス
Dependents: 300_PS3com Quadrifoglio_PS3COM
Master.cpp@3:9b1aefdd251a, 2022-06-18 (annotated)
- Committer:
- piroro4560
- Date:
- Sat Jun 18 08:42:38 2022 +0000
- Revision:
- 3:9b1aefdd251a
- Parent:
- 2:9d9681465f4a
- Child:
- 4:c9ef83cbe905
Successful shoot and kick
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
piroro4560 | 0:e2da5742a718 | 1 | #include "Master.h" |
piroro4560 | 0:e2da5742a718 | 2 | |
piroro4560 | 0:e2da5742a718 | 3 | Master::Master() : |
piroro4560 | 0:e2da5742a718 | 4 | pc(USBTX, USBRX, 115200) |
piroro4560 | 3:9b1aefdd251a | 5 | ,shot(Pin_Kicker) |
piroro4560 | 3:9b1aefdd251a | 6 | ,drib(Pin_Dribbler) |
piroro4560 | 0:e2da5742a718 | 7 | { |
piroro4560 | 1:60319e61775d | 8 | motor[0] = new KohiMD(Pin_motor_0); |
piroro4560 | 1:60319e61775d | 9 | motor[1] = new KohiMD(Pin_motor_1); |
piroro4560 | 1:60319e61775d | 10 | motor[2] = new KohiMD(Pin_motor_2); |
piroro4560 | 1:60319e61775d | 11 | motor[3] = new KohiMD(Pin_motor_3); |
piroro4560 | 0:e2da5742a718 | 12 | shot.setkickperiod(2.0); |
piroro4560 | 3:9b1aefdd251a | 13 | shot.setoutputtime(0.15); |
piroro4560 | 0:e2da5742a718 | 14 | drib.setspeed(0.0); |
piroro4560 | 0:e2da5742a718 | 15 | } |
piroro4560 | 0:e2da5742a718 | 16 | |
piroro4560 | 0:e2da5742a718 | 17 | void Master::SetPS3Address(bool *button_, uint8_t *trigger_, uint8_t *stick_) |
piroro4560 | 0:e2da5742a718 | 18 | { |
piroro4560 | 0:e2da5742a718 | 19 | button = button_; |
piroro4560 | 0:e2da5742a718 | 20 | stick = stick_; |
piroro4560 | 0:e2da5742a718 | 21 | trigger = trigger_; |
piroro4560 | 0:e2da5742a718 | 22 | } |
piroro4560 | 0:e2da5742a718 | 23 | |
piroro4560 | 0:e2da5742a718 | 24 | void Master::Shot() |
piroro4560 | 0:e2da5742a718 | 25 | { |
piroro4560 | 0:e2da5742a718 | 26 | shot.outPut(); |
piroro4560 | 0:e2da5742a718 | 27 | } |
piroro4560 | 2:9d9681465f4a | 28 | |
piroro4560 | 0:e2da5742a718 | 29 | void Master::Dribble(float power) |
piroro4560 | 0:e2da5742a718 | 30 | { |
piroro4560 | 0:e2da5742a718 | 31 | drib.setspeed(power); |
piroro4560 | 0:e2da5742a718 | 32 | } |
piroro4560 | 2:9d9681465f4a | 33 | |
piroro4560 | 0:e2da5742a718 | 34 | void Master::SetValueMotor(int num, double val) |
piroro4560 | 0:e2da5742a718 | 35 | { |
piroro4560 | 0:e2da5742a718 | 36 | motor[num]->setSpeed(val); |
piroro4560 | 0:e2da5742a718 | 37 | } |