広田 勇斗
/
Omni_2017_a
Omni_2017_a
Fork of Omni_2017_z by
2017_3_a/MD/MD.cpp@2:82c337a18500, 2017-08-05 (annotated)
- Committer:
- hirotayamato
- Date:
- Sat Aug 05 06:11:16 2017 +0000
- Revision:
- 2:82c337a18500
- Parent:
- 2017_3/MD/MD.cpp@0:fd933ea5f19d
Omni_2017_a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hirotayamato | 0:fd933ea5f19d | 1 | #include"mbed.h" |
hirotayamato | 0:fd933ea5f19d | 2 | #include"MD.h" |
hirotayamato | 0:fd933ea5f19d | 3 | MD::MD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere) |
hirotayamato | 0:fd933ea5f19d | 4 | { |
hirotayamato | 0:fd933ea5f19d | 5 | Pwm.period(0.0001); |
hirotayamato | 0:fd933ea5f19d | 6 | } |
hirotayamato | 0:fd933ea5f19d | 7 | |
hirotayamato | 0:fd933ea5f19d | 8 | void MD::rotate(double duty) |
hirotayamato | 0:fd933ea5f19d | 9 | { |
hirotayamato | 0:fd933ea5f19d | 10 | if(duty > 0) |
hirotayamato | 0:fd933ea5f19d | 11 | { |
hirotayamato | 0:fd933ea5f19d | 12 | Dere = 0; |
hirotayamato | 0:fd933ea5f19d | 13 | Pwm = duty; |
hirotayamato | 0:fd933ea5f19d | 14 | } |
hirotayamato | 0:fd933ea5f19d | 15 | else |
hirotayamato | 0:fd933ea5f19d | 16 | { |
hirotayamato | 0:fd933ea5f19d | 17 | Dere = 1; |
hirotayamato | 0:fd933ea5f19d | 18 | Pwm = -duty; |
hirotayamato | 0:fd933ea5f19d | 19 | } |
hirotayamato | 0:fd933ea5f19d | 20 | } |