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.
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;