a dc_motor drive lib use two PWM IO to drive the dc_motor
Dependents: Nucleo_F411RE_OS_Robot_Tank
Diff: motodriver.h
- Revision:
- 1:d31307e787fd
- Parent:
- 0:cd71771d494f
--- a/motodriver.h Tue Jun 19 08:50:21 2018 +0000 +++ b/motodriver.h Tue Jun 19 12:24:42 2018 +0000 @@ -6,15 +6,17 @@ public: Motor(PinName pwm1pin, PinName pwm2pin); + // 电机的开环控制函数,speed直接赋予PWM占空比,所以取值范围在0.0-1.0之间 float Speed(float speed); + // 关闭电机控制函数 void Stop(); private: PwmOut _pwm1; PwmOut _pwm2; - /** Initialization. */ + // 初始化函数 void init(); };