広田 勇斗
/
Omni_2017_a
Omni_2017_a
Fork of Omni_2017_z by
Diff: 2017_3_a/MD/MD.cpp
- Revision:
- 2:82c337a18500
- Parent:
- 0:fd933ea5f19d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2017_3_a/MD/MD.cpp Sat Aug 05 06:11:16 2017 +0000 @@ -0,0 +1,20 @@ +#include"mbed.h" +#include"MD.h" +MD::MD(PinName pwm,PinName dere):Pwm(pwm),Dere(dere) +{ + Pwm.period(0.0001); +} + +void MD::rotate(double duty) +{ + if(duty > 0) + { + Dere = 0; + Pwm = duty; + } + else + { + Dere = 1; + Pwm = -duty; + } +}