ALPHA_A
Dependencies: DataPool MD_PID mbed
2017_4/MD/MD.cpp@3:42fdfd41f96a, 2017-09-07 (annotated)
- Committer:
- hirotayamato
- Date:
- Thu Sep 07 00:37:39 2017 +0000
- Revision:
- 3:42fdfd41f96a
- Parent:
- 0:e77e7d7bbae0
ALPHA_A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirotayamato | 0:e77e7d7bbae0 | 1 | #include"mbed.h" |
hirotayamato | 0:e77e7d7bbae0 | 2 | #include"MD.h" |
hirotayamato | 0:e77e7d7bbae0 | 3 | MD::MD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere) |
hirotayamato | 0:e77e7d7bbae0 | 4 | { |
hirotayamato | 0:e77e7d7bbae0 | 5 | Pwm.period(0.0001); |
hirotayamato | 0:e77e7d7bbae0 | 6 | } |
hirotayamato | 0:e77e7d7bbae0 | 7 | |
hirotayamato | 0:e77e7d7bbae0 | 8 | void MD::rotate(double duty) |
hirotayamato | 0:e77e7d7bbae0 | 9 | { |
hirotayamato | 0:e77e7d7bbae0 | 10 | if(duty > 0) |
hirotayamato | 0:e77e7d7bbae0 | 11 | { |
hirotayamato | 0:e77e7d7bbae0 | 12 | Dere = 0; |
hirotayamato | 0:e77e7d7bbae0 | 13 | Pwm = duty; |
hirotayamato | 0:e77e7d7bbae0 | 14 | } |
hirotayamato | 0:e77e7d7bbae0 | 15 | else |
hirotayamato | 0:e77e7d7bbae0 | 16 | { |
hirotayamato | 0:e77e7d7bbae0 | 17 | Dere = 1; |
hirotayamato | 0:e77e7d7bbae0 | 18 | Pwm = -duty; |
hirotayamato | 0:e77e7d7bbae0 | 19 | } |
hirotayamato | 3:42fdfd41f96a | 20 | } |