Driver for two motors library
Driver.h@0:eafb70ae80f7, 2020-07-28 (annotated)
- Committer:
- cristian_junca
- Date:
- Tue Jul 28 05:46:24 2020 +0000
- Revision:
- 0:eafb70ae80f7
- Child:
- 1:e417951c16d7
Driver for two motors library
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 | 0:eafb70ae80f7 | 3 | class driver{ |
cristian_junca | 0:eafb70ae80f7 | 4 | |
cristian_junca | 0:eafb70ae80f7 | 5 | public: |
cristian_junca | 0:eafb70ae80f7 | 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 | }; |