A library for H-Bridge dual motor control

Revision:
1:b85eb4e982a9
Parent:
0:9ac0748f78d4
Child:
2:c0e11aaa32e7
--- a/DualMotorController.hpp	Sun Oct 22 08:08:35 2017 +0000
+++ b/DualMotorController.hpp	Sun Oct 22 10:38:11 2017 +0200
@@ -0,0 +1,27 @@
+#ifndef _DUALMOTORCONTROLLER_
+#define _DUALMOTORCONTROLLER_
+
+#include "mbed.h"
+
+class DualMotorController {
+
+public:
+    DualMotorController(PinName pwmL, PinName dirL0, PinName dirL1, PinName pwmR, PinName dirR0, PinName dirR1, float frequency = 100000.0f);
+
+    void SetLeft(float speed, bool forward);
+    void SetRight(float speed, bool forward);
+
+    //TODO : Invert direction
+    //TODO : Get current values
+    //TODO : Add braking
+
+
+private:
+    PwmOut _pwmL, _pwmR;
+    DigitalOut _dirL0, _dirR0;
+    DigitalOut _dirL1, _dirR1;
+
+    float _speedL, _speedR;
+    boolean _inverted;
+};
+#endif
\ No newline at end of file