a dc_motor drive lib use two PWM IO to drive the dc_motor
Dependents: Nucleo_F411RE_OS_Robot_Tank
Diff: motodriver.h
- Revision:
- 0:cd71771d494f
- Child:
- 1:d31307e787fd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/motodriver.h Tue Jun 19 08:50:21 2018 +0000 @@ -0,0 +1,21 @@ +#ifndef MOTORDRIVER_H_ADA +#define MOTORDRIVER_H_ADA + +class Motor +{ + public: + Motor(PinName pwm1pin, PinName pwm2pin); + + float Speed(float speed); + + void Stop(); + + private: + PwmOut _pwm1; + PwmOut _pwm2; + + /** Initialization. */ + void init(); +}; + +#endif \ No newline at end of file