A library for H-Bridge dual motor control

Committer:
Generic
Date:
Sun Oct 22 09:18:19 2017 +0000
Revision:
2:c0e11aaa32e7
Parent:
1:b85eb4e982a9
Changed boolean to bool. Fixed initialization order

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Cornelius Bezuidenhout 1:b85eb4e982a9 1 #ifndef _DUALMOTORCONTROLLER_
Cornelius Bezuidenhout 1:b85eb4e982a9 2 #define _DUALMOTORCONTROLLER_
Cornelius Bezuidenhout 1:b85eb4e982a9 3
Cornelius Bezuidenhout 1:b85eb4e982a9 4 #include "mbed.h"
Cornelius Bezuidenhout 1:b85eb4e982a9 5
Cornelius Bezuidenhout 1:b85eb4e982a9 6 class DualMotorController {
Cornelius Bezuidenhout 1:b85eb4e982a9 7
Cornelius Bezuidenhout 1:b85eb4e982a9 8 public:
Cornelius Bezuidenhout 1:b85eb4e982a9 9 DualMotorController(PinName pwmL, PinName dirL0, PinName dirL1, PinName pwmR, PinName dirR0, PinName dirR1, float frequency = 100000.0f);
Cornelius Bezuidenhout 1:b85eb4e982a9 10
Cornelius Bezuidenhout 1:b85eb4e982a9 11 void SetLeft(float speed, bool forward);
Cornelius Bezuidenhout 1:b85eb4e982a9 12 void SetRight(float speed, bool forward);
Cornelius Bezuidenhout 1:b85eb4e982a9 13
Cornelius Bezuidenhout 1:b85eb4e982a9 14 //TODO : Invert direction
Cornelius Bezuidenhout 1:b85eb4e982a9 15 //TODO : Get current values
Cornelius Bezuidenhout 1:b85eb4e982a9 16 //TODO : Add braking
Cornelius Bezuidenhout 1:b85eb4e982a9 17
Cornelius Bezuidenhout 1:b85eb4e982a9 18
Cornelius Bezuidenhout 1:b85eb4e982a9 19 private:
Cornelius Bezuidenhout 1:b85eb4e982a9 20 PwmOut _pwmL, _pwmR;
Cornelius Bezuidenhout 1:b85eb4e982a9 21 DigitalOut _dirL0, _dirR0;
Cornelius Bezuidenhout 1:b85eb4e982a9 22 DigitalOut _dirL1, _dirR1;
Cornelius Bezuidenhout 1:b85eb4e982a9 23
Cornelius Bezuidenhout 1:b85eb4e982a9 24 float _speedL, _speedR;
Generic 2:c0e11aaa32e7 25 bool _inverted;
Cornelius Bezuidenhout 1:b85eb4e982a9 26 };
Cornelius Bezuidenhout 1:b85eb4e982a9 27 #endif