Init
Dependents: JetflyerMotorController
Steering.h@1:787f4284d968, 2017-07-13 (annotated)
- Committer:
- skrickl
- Date:
- Thu Jul 13 13:42:23 2017 +0000
- Revision:
- 1:787f4284d968
- Parent:
- 0:21d9efc7ecb6
bla
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
skrickl | 1:787f4284d968 | 1 | #include "mbed.h" |
skrickl | 1:787f4284d968 | 2 | |
skrickl | 1:787f4284d968 | 3 | #ifndef STEERING_H |
skrickl | 1:787f4284d968 | 4 | #define STEERING_H |
skrickl | 1:787f4284d968 | 5 | |
skrickl | 1:787f4284d968 | 6 | #define PIN_PWM_STEERING p26 //or whatever |
skrickl | 1:787f4284d968 | 7 | #define PIN_DIR_STEERING p15 //or whatever |
skrickl | 1:787f4284d968 | 8 | |
skrickl | 1:787f4284d968 | 9 | #define MAX_PWM_SIGNAL 0.9f |
skrickl | 1:787f4284d968 | 10 | |
skrickl | 1:787f4284d968 | 11 | #define MAX_STEER_ANGLE 80 |
skrickl | 1:787f4284d968 | 12 | #define MIN_STEER_ANGLE -80 |
skrickl | 1:787f4284d968 | 13 | |
skrickl | 1:787f4284d968 | 14 | class Steering |
skrickl | 1:787f4284d968 | 15 | { |
skrickl | 1:787f4284d968 | 16 | public: |
skrickl | 1:787f4284d968 | 17 | |
skrickl | 1:787f4284d968 | 18 | Steering(); |
skrickl | 1:787f4284d968 | 19 | ~Steering(); |
skrickl | 1:787f4284d968 | 20 | |
skrickl | 1:787f4284d968 | 21 | void turn(float percentage); |
skrickl | 1:787f4284d968 | 22 | void setSteerAngle(int angle); |
skrickl | 1:787f4284d968 | 23 | void addToSteerAngle(int angle); |
skrickl | 1:787f4284d968 | 24 | int getSteerAngle(); |
skrickl | 1:787f4284d968 | 25 | int readCurrentAngle(); |
skrickl | 1:787f4284d968 | 26 | int getCurrentAngle(); |
skrickl | 1:787f4284d968 | 27 | |
skrickl | 1:787f4284d968 | 28 | private: |
skrickl | 1:787f4284d968 | 29 | |
skrickl | 1:787f4284d968 | 30 | int _steerAngle; |
skrickl | 1:787f4284d968 | 31 | int _currentAngle; |
skrickl | 1:787f4284d968 | 32 | |
skrickl | 1:787f4284d968 | 33 | PwmOut _pwm; |
skrickl | 1:787f4284d968 | 34 | DigitalOut _dir; |
skrickl | 1:787f4284d968 | 35 | |
skrickl | 1:787f4284d968 | 36 | }; |
skrickl | 1:787f4284d968 | 37 | |
skrickl | 1:787f4284d968 | 38 | #endif |