gjyrjyykkudt

Dependencies:   mbed MCP23017

Motor/Motor.h

Committer:
M_souta
Date:
2020-01-21
Revision:
1:5b0303768126
Parent:
0:db8d4af513c0
Child:
2:32d2cd7d744b

File content as of revision 1:5b0303768126:

#ifndef  MOTOR_H_
#define  MOTOR_H_

#include "mbed.h"

typedef enum dire {
    FREE  = 0,
    FOR   = 1,
    BACK  = 2,
    BRAKE = 3,
}dire;

class MOTOR {
    public:
        // 
        MOTOR(PinName D1, PinName D2, PinName pwm);
        /* direction
            FREE
            FOR
            BACK
            BRAKE
        */
        /* pwm
            pwm is 0 ~ 255(%)
        */
        // durection and pwm set
        void Dir(dire mode, uint8_t pwm);
        // direction set
        void Dir(dire mode);
        // pwm set
        void PWM(uint8_t pwm);
        
    private:
        DigitalOut D1_;
        DigitalOut D2_;
        PwmOut     pwm_;
};

#endif //MOTOR_H_