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

Dependents:   Car_Simulator

DCMotor.h

Committer:
kaushalpkk
Date:
2011-07-15
Revision:
1:88772267f757
Parent:
0:c92be90656b7
Child:
2:46bca6d9dbda

File content as of revision 1:88772267f757:

#ifndef MBED_DCMOTOR_H
#define MBED_DCMOTOR_H

#include "mbed.h"

class DCMotor {

public:
    /** create a DCMotor object connected to the pins with speed control
    *   @param PWMPin   PWM pin to control speed of motor
    *   @param PinA     Digital output pin to connect to motor
    *   @param PinB     Digital output pin to connect to motor
    */
    DCMotor(PinName PWMPin, PinName PinA, PinName PinB);
    
    /** drive Motor input range (-100 to 100).
    *   @param perCent   PWM pin to control speed of motor
    */
    void driveIt(float);

protected:
    PwmOut _PWMPin;
    DigitalOut _PinA;
    DigitalOut _PinB;
};

#endif