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.
motor.cpp@0:51c12cc34baf, 2018-02-01 (annotated)
- Committer:
- martinsimpson
- Date:
- Thu Feb 01 12:59:21 2018 +0000
- Revision:
- 0:51c12cc34baf
- Child:
- 1:3ca91ad8e927
First Commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| martinsimpson | 0:51c12cc34baf | 1 | #include "motor.h" |
| martinsimpson | 0:51c12cc34baf | 2 | |
| martinsimpson | 0:51c12cc34baf | 3 | Motor::Motor(PinName pinName1, PinName pinName2) : pin1(pinName1), pin2(pinName2) |
| martinsimpson | 0:51c12cc34baf | 4 | { |
| martinsimpson | 0:51c12cc34baf | 5 | } |
| martinsimpson | 0:51c12cc34baf | 6 | void Motor::Fwd(float duty) |
| martinsimpson | 0:51c12cc34baf | 7 | { |
| martinsimpson | 0:51c12cc34baf | 8 | this->pin1 = 0.0f; |
| martinsimpson | 0:51c12cc34baf | 9 | this->pin2 = duty; |
| martinsimpson | 0:51c12cc34baf | 10 | } |
| martinsimpson | 0:51c12cc34baf | 11 | void Motor::Rev(float duty) |
| martinsimpson | 0:51c12cc34baf | 12 | { |
| martinsimpson | 0:51c12cc34baf | 13 | this->pin1 = duty; |
| martinsimpson | 0:51c12cc34baf | 14 | this->pin2 = 0.0f; |
| martinsimpson | 0:51c12cc34baf | 15 | } |
| martinsimpson | 0:51c12cc34baf | 16 | void Motor::Period_in_ms(int msPeriod) |
| martinsimpson | 0:51c12cc34baf | 17 | { |
| martinsimpson | 0:51c12cc34baf | 18 | this->pin1.period_ms(msPeriod); |
| martinsimpson | 0:51c12cc34baf | 19 | this->pin2.period_ms(msPeriod); |
| martinsimpson | 0:51c12cc34baf | 20 | } |