GAMMA_A
Dependencies: DataPool MD_PID mbed
2017_3_b/MD/MD.cpp@2:158fea945e51, 2017-08-25 (annotated)
- Committer:
- hirotayamato
- Date:
- Fri Aug 25 07:40:49 2017 +0000
- Revision:
- 2:158fea945e51
- Parent:
- 0:6ed41770a6b7
GAMMA_A;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirotayamato | 0:6ed41770a6b7 | 1 | #include"mbed.h" |
hirotayamato | 0:6ed41770a6b7 | 2 | #include"MD.h" |
hirotayamato | 0:6ed41770a6b7 | 3 | MD::MD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere) |
hirotayamato | 0:6ed41770a6b7 | 4 | { |
hirotayamato | 0:6ed41770a6b7 | 5 | Pwm.period(0.0001); |
hirotayamato | 0:6ed41770a6b7 | 6 | } |
hirotayamato | 0:6ed41770a6b7 | 7 | |
hirotayamato | 0:6ed41770a6b7 | 8 | void MD::rotate(double duty) |
hirotayamato | 0:6ed41770a6b7 | 9 | { |
hirotayamato | 0:6ed41770a6b7 | 10 | if(duty > 0) |
hirotayamato | 0:6ed41770a6b7 | 11 | { |
hirotayamato | 0:6ed41770a6b7 | 12 | Dere = 0; |
hirotayamato | 0:6ed41770a6b7 | 13 | Pwm = duty; |
hirotayamato | 0:6ed41770a6b7 | 14 | } |
hirotayamato | 0:6ed41770a6b7 | 15 | else |
hirotayamato | 0:6ed41770a6b7 | 16 | { |
hirotayamato | 0:6ed41770a6b7 | 17 | Dere = 1; |
hirotayamato | 0:6ed41770a6b7 | 18 | Pwm = -duty; |
hirotayamato | 0:6ed41770a6b7 | 19 | } |
hirotayamato | 2:158fea945e51 | 20 | } |