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.
Dependencies: DataPool MD_PID mbed
2017_3_h/MD/MD.cpp@11:5365da759270, 2017-09-15 (annotated)
- Committer:
- hirotayamato
- Date:
- Fri Sep 15 01:09:18 2017 +0000
- Revision:
- 11:5365da759270
- Parent:
- 0:b8fa7a019f5d
BETA_A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirotayamato | 0:b8fa7a019f5d | 1 | #include"mbed.h" |
hirotayamato | 0:b8fa7a019f5d | 2 | #include"MD.h" |
hirotayamato | 0:b8fa7a019f5d | 3 | MD::MD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere) |
hirotayamato | 0:b8fa7a019f5d | 4 | { |
hirotayamato | 0:b8fa7a019f5d | 5 | Pwm.period(0.0001); |
hirotayamato | 0:b8fa7a019f5d | 6 | } |
hirotayamato | 0:b8fa7a019f5d | 7 | |
hirotayamato | 0:b8fa7a019f5d | 8 | void MD::rotate(double duty) |
hirotayamato | 0:b8fa7a019f5d | 9 | { |
hirotayamato | 0:b8fa7a019f5d | 10 | if(duty > 0) |
hirotayamato | 0:b8fa7a019f5d | 11 | { |
hirotayamato | 0:b8fa7a019f5d | 12 | Dere = 0; |
hirotayamato | 0:b8fa7a019f5d | 13 | Pwm = duty; |
hirotayamato | 0:b8fa7a019f5d | 14 | } |
hirotayamato | 0:b8fa7a019f5d | 15 | else |
hirotayamato | 0:b8fa7a019f5d | 16 | { |
hirotayamato | 0:b8fa7a019f5d | 17 | Dere = 1; |
hirotayamato | 0:b8fa7a019f5d | 18 | Pwm = -duty; |
hirotayamato | 0:b8fa7a019f5d | 19 | } |
hirotayamato | 0:b8fa7a019f5d | 20 | } |