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.
serial.cpp@1:8a18949cc79d, 2019-02-26 (annotated)
- Committer:
- Akatsukya
- Date:
- Tue Feb 26 04:09:21 2019 +0000
- Revision:
- 1:8a18949cc79d
- Parent:
- 0:a0096d6aedd3
move end
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Akatsukya | 1:8a18949cc79d | 1 | #include "setting.hpp" |
Akatsukya | 1:8a18949cc79d | 2 | |
Akatsukya | 1:8a18949cc79d | 3 | void move(PwmOut *pwm_p, DigitalOut *digital_p, float power){ |
Akatsukya | 1:8a18949cc79d | 4 | // power は -1.0 ~ 1.0 まで |
Akatsukya | 1:8a18949cc79d | 5 | if (power >= -1.0 && power <= 1.0){ |
Akatsukya | 1:8a18949cc79d | 6 | if (power >= 0){ |
Akatsukya | 1:8a18949cc79d | 7 | //power が 前進 |
Akatsukya | 1:8a18949cc79d | 8 | digital_p->write(0); |
Akatsukya | 1:8a18949cc79d | 9 | pwm_p->write(power); |
Akatsukya | 1:8a18949cc79d | 10 | } else { |
Akatsukya | 1:8a18949cc79d | 11 | // power が 後進 |
Akatsukya | 1:8a18949cc79d | 12 | digital_p->write(1); |
Akatsukya | 1:8a18949cc79d | 13 | pwm_p->write(1.0 - (power * -1.0)); |
Akatsukya | 1:8a18949cc79d | 14 | } |
Akatsukya | 1:8a18949cc79d | 15 | } |
Akatsukya | 1:8a18949cc79d | 16 | } |