Library for driving a motor with a DRV8833 motor driver or similar.
Motor.h@0:0d650a332dcc, 2014-10-19 (annotated)
- Committer:
- pclary
- Date:
- Sun Oct 19 07:51:25 2014 +0000
- Revision:
- 0:0d650a332dcc
Code imported from Micromouse 2014
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pclary | 0:0d650a332dcc | 1 | #ifndef MOTOR_H |
pclary | 0:0d650a332dcc | 2 | #define MOTOR_H |
pclary | 0:0d650a332dcc | 3 | |
pclary | 0:0d650a332dcc | 4 | #include "mbed.h" |
pclary | 0:0d650a332dcc | 5 | |
pclary | 0:0d650a332dcc | 6 | |
pclary | 0:0d650a332dcc | 7 | class Motor |
pclary | 0:0d650a332dcc | 8 | { |
pclary | 0:0d650a332dcc | 9 | public: |
pclary | 0:0d650a332dcc | 10 | Motor(PinName pin1, PinName pin2); |
pclary | 0:0d650a332dcc | 11 | void speed(float value); |
pclary | 0:0d650a332dcc | 12 | Motor& operator=(float value); |
pclary | 0:0d650a332dcc | 13 | void brake(); |
pclary | 0:0d650a332dcc | 14 | |
pclary | 0:0d650a332dcc | 15 | private: |
pclary | 0:0d650a332dcc | 16 | PwmOut pwm1; |
pclary | 0:0d650a332dcc | 17 | PwmOut pwm2; |
pclary | 0:0d650a332dcc | 18 | }; |
pclary | 0:0d650a332dcc | 19 | |
pclary | 0:0d650a332dcc | 20 | #endif // MOTOR_H |