cleaned up motor class with separate header and .cpp files

Dependencies:   mbed

Dependents:   TerraBot_Drive_2D TerraBot_Drive_2D TerraBot_Drive_2D_FINAL DUMP_TRUCK_Test ... more

Motor.h

Committer:
simplyellow
Date:
2017-02-14
Revision:
4:e87768d3cd09
Parent:
2:7674afbf8e53

File content as of revision 4:e87768d3cd09:

/**
*   @file   Motor.h
*
*   @brief  Motor class implements API for controlling motors.
*
*   @author Terrabots Team
*
*/

#ifndef MOTOR_H
#define MOTOR_H

#include "mbed.h"

/**
*   @class Motor
*
*   @brief  Interface for controlling the dump truck's motors
*/

class Motor {
    public:
        /**
        *   Constructor for the Motor object.
        *
        *   @param[in]  pwm     The PwmOut pin used for controlling speed.
        *   @param[in]  dir     The DigitalOut pin used for controlling direction.
        */
        Motor(PinName pwm, PinName dir);
        /**
        *   Command the motor to run at a desired speed
        *
        *   @param[in]  Val     The desired speed of type float.
        */
        void write(float Val);
        /**
        *   Read the speed of the motor
        */
        float read();
    private:
        PwmOut pwmPin;
        DigitalOut dirPin;
        float lastVal;
    
};

#endif