software to control a DC motor, preferably interfacing with a motor driver.

Dependents:   Car_Simulator

Committer:
kaushalpkk
Date:
Fri Jul 15 17:56:07 2011 +0000
Revision:
1:88772267f757
Parent:
0:c92be90656b7
Child:
2:46bca6d9dbda
Used Doxygen for documenting the library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kaushalpkk 0:c92be90656b7 1 #ifndef MBED_DCMOTOR_H
kaushalpkk 0:c92be90656b7 2 #define MBED_DCMOTOR_H
kaushalpkk 0:c92be90656b7 3
kaushalpkk 0:c92be90656b7 4 #include "mbed.h"
kaushalpkk 0:c92be90656b7 5
kaushalpkk 0:c92be90656b7 6 class DCMotor {
kaushalpkk 0:c92be90656b7 7
kaushalpkk 0:c92be90656b7 8 public:
kaushalpkk 1:88772267f757 9 /** create a DCMotor object connected to the pins with speed control
kaushalpkk 1:88772267f757 10 * @param PWMPin PWM pin to control speed of motor
kaushalpkk 1:88772267f757 11 * @param PinA Digital output pin to connect to motor
kaushalpkk 1:88772267f757 12 * @param PinB Digital output pin to connect to motor
kaushalpkk 1:88772267f757 13 */
kaushalpkk 0:c92be90656b7 14 DCMotor(PinName PWMPin, PinName PinA, PinName PinB);
kaushalpkk 1:88772267f757 15
kaushalpkk 1:88772267f757 16 /** drive Motor input range (-100 to 100).
kaushalpkk 1:88772267f757 17 * @param perCent PWM pin to control speed of motor
kaushalpkk 1:88772267f757 18 */
kaushalpkk 0:c92be90656b7 19 void driveIt(float);
kaushalpkk 1:88772267f757 20
kaushalpkk 0:c92be90656b7 21 protected:
kaushalpkk 0:c92be90656b7 22 PwmOut _PWMPin;
kaushalpkk 0:c92be90656b7 23 DigitalOut _PinA;
kaushalpkk 0:c92be90656b7 24 DigitalOut _PinB;
kaushalpkk 0:c92be90656b7 25 };
kaushalpkk 0:c92be90656b7 26
kaushalpkk 0:c92be90656b7 27 #endif