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: serial.cpp
- Revision:
- 1:8a18949cc79d
- Parent:
- 0:a0096d6aedd3
--- a/serial.cpp Sun Feb 24 11:55:22 2019 +0000 +++ b/serial.cpp Tue Feb 26 04:09:21 2019 +0000 @@ -1,1 +1,16 @@ -#include "setting.hpp" \ No newline at end of file +#include "setting.hpp" + +void move(PwmOut *pwm_p, DigitalOut *digital_p, float power){ + // power は -1.0 ~ 1.0 まで + if (power >= -1.0 && power <= 1.0){ + if (power >= 0){ + //power が 前進 + digital_p->write(0); + pwm_p->write(power); + } else { + // power が 後進 + digital_p->write(1); + pwm_p->write(1.0 - (power * -1.0)); + } + } +} \ No newline at end of file