VNH5019 motor driver library
Diff: vnh5019.h
- Revision:
- 0:666c49565378
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vnh5019.h Thu Feb 03 08:30:44 2022 +0000 @@ -0,0 +1,33 @@ +#ifndef VNH5019_H +#define VNH5019_H + +#include "mbed.h" +/** +* vnh5019 class +* class to drive vnh5019 +*/ +class VNH5019 +{ +public: + /** creates VNH5019 instance + *@param _dirH dirH pin + *@param _dirL dirL pin + *@param _pwm pwm pin + */ + VNH5019(PinName _dirH,PinName _dirL,PinName _pwm); + /** set drive Mode won't work after setMotorSpeed() is called + */ + int setMotorSpeed(float speed); + /** set pwm frequency + *@param frequency needs to be bigger than 0 + */ + int setFreq(float freq); + /** set this variable to 1 if you want to brake when the motorSpeed is set to 0 + */ + bool braking; +private: + bool started; + DigitalOut dirH,dirL; + PwmOut pwm; +}; +#endif \ No newline at end of file