Init
Dependents: JetflyerMotorController
Motor.h@1:39b173360768, 2017-07-13 (annotated)
- Committer:
- skrickl
- Date:
- Thu Jul 13 13:42:32 2017 +0000
- Revision:
- 1:39b173360768
- Parent:
- 0:5eb2bad9ea40
bla
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
skrickl | 1:39b173360768 | 1 | #include "mbed.h" |
skrickl | 1:39b173360768 | 2 | |
skrickl | 1:39b173360768 | 3 | |
skrickl | 1:39b173360768 | 4 | #ifndef MOTOR_H |
skrickl | 1:39b173360768 | 5 | #define MOTOR_H |
skrickl | 1:39b173360768 | 6 | |
skrickl | 1:39b173360768 | 7 | #define pin_forward p29 |
skrickl | 1:39b173360768 | 8 | #define pin_backward p30 |
skrickl | 1:39b173360768 | 9 | #define pin_pwm_motor p23 |
skrickl | 1:39b173360768 | 10 | |
skrickl | 1:39b173360768 | 11 | |
skrickl | 1:39b173360768 | 12 | |
skrickl | 1:39b173360768 | 13 | |
skrickl | 1:39b173360768 | 14 | class Motor |
skrickl | 1:39b173360768 | 15 | { |
skrickl | 1:39b173360768 | 16 | public: |
skrickl | 1:39b173360768 | 17 | Motor(); |
skrickl | 1:39b173360768 | 18 | ~Motor(); |
skrickl | 1:39b173360768 | 19 | |
skrickl | 1:39b173360768 | 20 | DigitalOut forward; |
skrickl | 1:39b173360768 | 21 | DigitalOut backward; |
skrickl | 1:39b173360768 | 22 | AnalogOut throttle; |
skrickl | 1:39b173360768 | 23 | |
skrickl | 1:39b173360768 | 24 | int drive(int speed, int direction); |
skrickl | 1:39b173360768 | 25 | |
skrickl | 1:39b173360768 | 26 | |
skrickl | 1:39b173360768 | 27 | private: |
skrickl | 1:39b173360768 | 28 | |
skrickl | 1:39b173360768 | 29 | int direction_old; |
skrickl | 1:39b173360768 | 30 | |
skrickl | 1:39b173360768 | 31 | |
skrickl | 1:39b173360768 | 32 | }; |
skrickl | 1:39b173360768 | 33 | |
skrickl | 1:39b173360768 | 34 | #endif |