A library for H-Bridge dual motor control
DualMotorController.hpp@1:b85eb4e982a9, 2017-10-22 (annotated)
- Committer:
- Cornelius Bezuidenhout
- Date:
- Sun Oct 22 10:38:11 2017 +0200
- Revision:
- 1:b85eb4e982a9
- Parent:
- 0:9ac0748f78d4
- Child:
- 2:c0e11aaa32e7
Initial basic function test
Who changed what in which revision?
User | Revision | Line number | New 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; |
Cornelius Bezuidenhout |
1:b85eb4e982a9 | 25 | boolean _inverted; |
Cornelius Bezuidenhout |
1:b85eb4e982a9 | 26 | }; |
Cornelius Bezuidenhout |
1:b85eb4e982a9 | 27 | #endif |