Simple DC motor control commands for driving DC motor conroller with PWM and up to 2 direction signals (complementary). Takes float value from -1.0 to 1.0.
Dependents: Teensy_Mot_QEI_Ser_20180111 Axis Axis_20181108 Axis_version2
Fork of MotCon by
Overloaded class that takes a pwm motor control pin and one or two direction pins for driving DC motors with a variety of motor control IC's. Tested examples include the LM298, TD340, MC33926, A3949.
Diff: MotCon.h
- Revision:
- 2:23cd902e1774
- Parent:
- 1:69e79f1db999
diff -r 69e79f1db999 -r 23cd902e1774 MotCon.h --- a/MotCon.h Thu May 19 12:36:45 2016 +0000 +++ b/MotCon.h Thu May 19 13:17:10 2016 +0000 @@ -4,10 +4,25 @@ #ifndef MBED_MOTCON_H #define MBED_MOTCON_H +/** MotCon class. + * Used for generating motor control pulse width modulation control + * and direction signal outputs for motor driver boards + */ class MotCon{ public: + /** Create MotCon instance */ MotCon(PinName _pwm, PinName _dir); + + /** Drive motor control signals + * + * @param dc value from (+/-1.0) + */ void mot_control(float dc); + /** Overloaded function for Drive motor control signals + * + * @param dc value from (+/-1.0) + * @param invert any non-zero value inverts the motor direction signal output logic + */ void mot_control(float dc, int invert); private: PwmOut _pwm;