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
Fork of Chemical_Sensor_DMA by
MotorControl.h@5:1b2dc43e8947, 2015-11-06 (annotated)
- Committer:
- baxterja
- Date:
- Fri Nov 06 19:28:49 2015 +0000
- Revision:
- 5:1b2dc43e8947
- Parent:
- 2:3771b3195c7b
Dewayne, Use this one
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
baxterja | 2:3771b3195c7b | 1 | #ifndef MOTOR_CONTROL_H |
baxterja | 2:3771b3195c7b | 2 | #define MOTOR_CONTROL_H |
baxterja | 2:3771b3195c7b | 3 | |
baxterja | 2:3771b3195c7b | 4 | #include "mbed.h" |
baxterja | 2:3771b3195c7b | 5 | #include "pause.cpp" |
baxterja | 2:3771b3195c7b | 6 | |
baxterja | 2:3771b3195c7b | 7 | class MotorControl { |
baxterja | 2:3771b3195c7b | 8 | public: |
baxterja | 2:3771b3195c7b | 9 | MotorControl(PinName cw, PinName ccw, int period, int safetyPeriod); |
baxterja | 2:3771b3195c7b | 10 | |
baxterja | 2:3771b3195c7b | 11 | void off(); // make sure the motor is off |
baxterja | 2:3771b3195c7b | 12 | void clockwise(float); |
baxterja | 2:3771b3195c7b | 13 | void releaseMallet(); // release mallet using hard coded timing |
baxterja | 2:3771b3195c7b | 14 | void reset(); // reset mallet using feedback (NEEDS TO BE IMPLEMENTED) |
baxterja | 2:3771b3195c7b | 15 | |
baxterja | 2:3771b3195c7b | 16 | // what we threw together just for testing |
baxterja | 2:3771b3195c7b | 17 | void hardReset(int); // reset mallet using hard coded timing |
baxterja | 2:3771b3195c7b | 18 | |
baxterja | 2:3771b3195c7b | 19 | private: |
baxterja | 2:3771b3195c7b | 20 | PwmOut _cw; // clock wise rotation when _cw = 1 |
baxterja | 2:3771b3195c7b | 21 | PwmOut _ccw; // counter-clock wise rotation when _ccw = 1 |
baxterja | 2:3771b3195c7b | 22 | int _period; // the period of the motor switching cycle |
baxterja | 2:3771b3195c7b | 23 | int _safetyPeriod; // dead time between transition from cw to ccw (and visa versa) |
baxterja | 2:3771b3195c7b | 24 | }; |
baxterja | 2:3771b3195c7b | 25 | |
baxterja | 2:3771b3195c7b | 26 | #endif |