Driver for two motors library
Driver.h@1:e417951c16d7, 2020-07-29 (annotated)
- Committer:
- cristian_junca
- Date:
- Wed Jul 29 04:40:37 2020 +0000
- Revision:
- 1:e417951c16d7
- Parent:
- 0:eafb70ae80f7
Library to driver two dc motors;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cristian_junca | 0:eafb70ae80f7 | 1 | #include "mbed.h" |
cristian_junca | 0:eafb70ae80f7 | 2 | |
cristian_junca | 1:e417951c16d7 | 3 | class Driver{ |
cristian_junca | 0:eafb70ae80f7 | 4 | |
cristian_junca | 0:eafb70ae80f7 | 5 | public: |
cristian_junca | 1:e417951c16d7 | 6 | Driver(PinName M1A, PinName M1B, PinName M2A, PinName M2B); |
cristian_junca | 0:eafb70ae80f7 | 7 | void setPeriod_ms(int32_t); |
cristian_junca | 0:eafb70ae80f7 | 8 | void forward(float, float); |
cristian_junca | 0:eafb70ae80f7 | 9 | void backward(float, float); |
cristian_junca | 0:eafb70ae80f7 | 10 | void right(float, float); |
cristian_junca | 0:eafb70ae80f7 | 11 | void left(float, float); |
cristian_junca | 0:eafb70ae80f7 | 12 | void neutral(); |
cristian_junca | 0:eafb70ae80f7 | 13 | |
cristian_junca | 0:eafb70ae80f7 | 14 | protected: |
cristian_junca | 0:eafb70ae80f7 | 15 | PwmOut M1A; |
cristian_junca | 0:eafb70ae80f7 | 16 | PwmOut M1B; |
cristian_junca | 0:eafb70ae80f7 | 17 | PwmOut M2A; |
cristian_junca | 0:eafb70ae80f7 | 18 | PwmOut M2B; |
cristian_junca | 0:eafb70ae80f7 | 19 | float _dutyCycle1; |
cristian_junca | 0:eafb70ae80f7 | 20 | float _dutyCycle2; |
cristian_junca | 0:eafb70ae80f7 | 21 | int32_t _period; |
cristian_junca | 0:eafb70ae80f7 | 22 | }; |