Ironcup Mar 2020
Dependencies: mbed mbed-rtos MotionSensor EthernetInterface
Motor/Motor.h@22:b7cca3089dfe, 2020-09-21 (annotated)
- Committer:
- starling
- Date:
- Mon Sep 21 21:45:08 2020 +0000
- Revision:
- 22:b7cca3089dfe
- Parent:
- 20:7138ab2f93f7
01 mar 2020
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
drelliak | 12:273752f540be | 1 | #ifndef MOTOR_HEADER |
drelliak | 12:273752f540be | 2 | #define MOTOR_HEADER |
drelliak | 12:273752f540be | 3 | |
drelliak | 12:273752f540be | 4 | #include "mbed.h" |
drelliak | 12:273752f540be | 5 | #include "CarPWM.h" |
drelliak | 12:273752f540be | 6 | |
drelliak | 12:273752f540be | 7 | class Motor{ |
drelliak | 12:273752f540be | 8 | |
drelliak | 12:273752f540be | 9 | protected: |
drelliak | 12:273752f540be | 10 | Ticker interruption; |
drelliak | 12:273752f540be | 11 | bool alternate_motor; |
drelliak | 12:273752f540be | 12 | float velocity; |
drelliak | 12:273752f540be | 13 | float jog_duty_cycle; |
drelliak | 12:273752f540be | 14 | float jog_period; |
drelliak | 12:273752f540be | 15 | PwmOut motor; |
drelliak | 12:273752f540be | 16 | |
drelliak | 12:273752f540be | 17 | public: |
drelliak | 12:273752f540be | 18 | |
drelliak | 12:273752f540be | 19 | void startJogging(float jog_dc, float jog_p); |
drelliak | 12:273752f540be | 20 | void stopJogging(void); |
drelliak | 20:7138ab2f93f7 | 21 | void brakeMotor(float brake_intensity, float brake_wait); |
drelliak | 12:273752f540be | 22 | void reverseMotor(int speed); |
drelliak | 12:273752f540be | 23 | void setVelocity(int new_velocity); |
drelliak | 20:7138ab2f93f7 | 24 | float getVelocity(); |
drelliak | 12:273752f540be | 25 | void setSmoothVelocity(int new_velocity); |
starling | 22:b7cca3089dfe | 26 | Motor(): motor(PTC3){} |
drelliak | 12:273752f540be | 27 | |
drelliak | 12:273752f540be | 28 | private: |
drelliak | 12:273752f540be | 29 | void motorJogging(void); |
drelliak | 12:273752f540be | 30 | |
drelliak | 12:273752f540be | 31 | }; |
drelliak | 12:273752f540be | 32 | #endif |