Mechatronics projectA'
Fork of Motor by
Diff: Motor.h
- Revision:
- 1:e341f695742a
- Parent:
- 0:a470311addc4
- Child:
- 2:f265e441bcd9
--- a/Motor.h Thu Jun 10 11:31:02 2010 +0000 +++ b/Motor.h Sat Jul 10 07:46:17 2010 +0000 @@ -25,10 +25,25 @@ #include "mbed.h" +/** Interface to control a standard DC motor + * with an H-bridge using a PwmOut and 2 DigitalOuts + */ class Motor { public: + + /** Create a motor control interface + * + * @param pwm A PwmOut pin, driving the H-bridge enable line to control the speed + * @param fwd A DigitalOut, set high when the motor should go forward + * @param rev A DigitalOut, set high when the motor should go backwards + */ Motor(PinName pwm, PinName fwd, PinName rev); - void speed(float); + + /** Set the speed of the motor + * + * @param speed The speed of the motor as a normalised value between -1.0 and 1.0 + */ + void speed(float speed); protected: PwmOut _pwm;