added gy80 dcm
Dependencies: mbed DCM_AHRS_GY80 PID MMA8451Q
Fork of quadCommand by
quadCommand/motor/motor.h@38:9f33129afce2, 2013-06-10 (annotated)
- Committer:
- gabdo
- Date:
- Mon Jun 10 01:04:35 2013 +0000
- Revision:
- 38:9f33129afce2
- Parent:
- 0:8681037b9a18
- Child:
- 45:088885f4a13d
Motor mod
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gabdo | 0:8681037b9a18 | 1 | /******************************* motor.h *********************************/ |
gabdo | 0:8681037b9a18 | 2 | /* Version: 1.0 */ |
gabdo | 0:8681037b9a18 | 3 | /* Last Updated: June 1, 2013 */ |
gabdo | 0:8681037b9a18 | 4 | /* */ |
gabdo | 0:8681037b9a18 | 5 | /* The motor class is used for motor control using a PWM ECS. When a */ |
gabdo | 0:8681037b9a18 | 6 | /*a motor object is created you must pass the PWM pin as the only */ |
gabdo | 0:8681037b9a18 | 7 | /*argument. */ |
gabdo | 0:8681037b9a18 | 8 | /* */ |
gabdo | 0:8681037b9a18 | 9 | /* Wiring diagrams */ |
gabdo | 0:8681037b9a18 | 10 | /* _______ _______ */ |
gabdo | 0:8681037b9a18 | 11 | /* CW ----| | CCW ---\/ --| | */ |
gabdo | 0:8681037b9a18 | 12 | /* ----| Motor | ---/\---| Motor | */ |
gabdo | 0:8681037b9a18 | 13 | /* ----|_______| --/ \--|_______| */ |
gabdo | 0:8681037b9a18 | 14 | /* Straight through Switch wire 1 and 3 */ |
gabdo | 0:8681037b9a18 | 15 | /* */ |
gabdo | 0:8681037b9a18 | 16 | /*************************************************************************/ |
gabdo | 0:8681037b9a18 | 17 | |
gabdo | 0:8681037b9a18 | 18 | |
gabdo | 0:8681037b9a18 | 19 | #ifndef MOTOR_H |
gabdo | 0:8681037b9a18 | 20 | #define MOTOR_H |
gabdo | 0:8681037b9a18 | 21 | |
gabdo | 0:8681037b9a18 | 22 | #include "mbed.h" |
gabdo | 0:8681037b9a18 | 23 | |
gabdo | 0:8681037b9a18 | 24 | class motor |
gabdo | 0:8681037b9a18 | 25 | { |
gabdo | 0:8681037b9a18 | 26 | public: |
gabdo | 0:8681037b9a18 | 27 | motor( PinName ); // motor object constructor. |
gabdo | 0:8681037b9a18 | 28 | void setSpeed( int ); // Set the speed for the motor 0-100 |
gabdo | 0:8681037b9a18 | 29 | void setPulseMin( float ); // Set smallest pulse. |
gabdo | 0:8681037b9a18 | 30 | void setPulseMax( float ); // Set largest pulse. |
gabdo | 38:9f33129afce2 | 31 | int getSpeed(); |
gabdo | 0:8681037b9a18 | 32 | float getPulse( void ); |
gabdo | 0:8681037b9a18 | 33 | |
gabdo | 0:8681037b9a18 | 34 | private: |
gabdo | 0:8681037b9a18 | 35 | PwmOut _pwm; // Pin used for PWM. |
gabdo | 0:8681037b9a18 | 36 | int currentSpeed; // Speed of the motor. |
gabdo | 0:8681037b9a18 | 37 | float pulse; // Current pulse of the motor. |
gabdo | 0:8681037b9a18 | 38 | float pulseMin; // Shortest value for the pulse |
gabdo | 0:8681037b9a18 | 39 | float pulseMax; // Largest value for the pulse.. |
gabdo | 0:8681037b9a18 | 40 | }; |
gabdo | 0:8681037b9a18 | 41 | |
gabdo | 0:8681037b9a18 | 42 | #endif |