ALPHA_A
Dependencies: DataPool MD_PID mbed
Diff: 2017_4/MD/MD.cpp
- Revision:
- 0:e77e7d7bbae0
- Child:
- 3:42fdfd41f96a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/2017_4/MD/MD.cpp Wed Aug 30 05:23:13 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; + } +}