Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: moves/moves.cpp
- Revision:
- 31:ed4249a288d7
- Parent:
- 30:231e6584afe9
- Child:
- 32:aee87dcaf7ca
--- a/moves/moves.cpp Wed May 08 09:16:30 2019 +0000 +++ b/moves/moves.cpp Wed May 08 11:00:09 2019 +0000 @@ -20,7 +20,7 @@ STOP, FORWARD, }; -int step_num_l; +int step_num_l, step_num_r; void WaitAnotherLeg(); //収束していなければLED1をON. param:: d_step_l:左足を動かす歩数。負なら後ろに進む @@ -35,6 +35,18 @@ robot.run(); led1 = 0; step_num_l = target_step; + switch(mode) + { + case FORWARD: + step_num_r++; + break; + case STOP: + break; + case BACK: + step_num_r--; + break; + } + motor_lo_f.write(0); motor_lo_b.write(0); motor_li_f.write(0); @@ -100,6 +112,17 @@ { Run(STOP, 1); } +void phasing(float target_degree) +{ + if(step_num_l%2 != step_num_r%2) + { + if(target_degree - degree0 > 0) { + curveLeft(); + } else { + curveRight(); + } + } +} void SetupMoves() { motor_lo_f.period_us(100);