Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed mbed-rtos MotionSensor EthernetInterface
Motor/Motor.h@12:273752f540be, 2016-04-30 (annotated)
- Committer:
- drelliak
- Date:
- Sat Apr 30 21:23:13 2016 +0000
- Revision:
- 12:273752f540be
- Child:
- 20:7138ab2f93f7
TrekkingController with the gyroscope class and motor class
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 | 12:273752f540be | 21 | void brakeMotor(void); |
| drelliak | 12:273752f540be | 22 | void reverseMotor(int speed); |
| drelliak | 12:273752f540be | 23 | void setVelocity(int new_velocity); |
| drelliak | 12:273752f540be | 24 | void setSmoothVelocity(int new_velocity); |
| drelliak | 12:273752f540be | 25 | Motor(): motor(PTD1){} |
| drelliak | 12:273752f540be | 26 | |
| drelliak | 12:273752f540be | 27 | private: |
| drelliak | 12:273752f540be | 28 | void motorJogging(void); |
| drelliak | 12:273752f540be | 29 | |
| drelliak | 12:273752f540be | 30 | }; |
| drelliak | 12:273752f540be | 31 | #endif |