Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

motor.h

Committer:
sahilmgandhi
Date:
21 months ago
Revision:
46:b156ef445742
Parent:
15:b80555a4a8b9

File content as of revision 46:b156ef445742:

#ifndef MOTOR_H
#define MOTOR_H

#include "mbed.h"
//#include "main.h"

#define BRAKE_VOLTAGE 0.2

/*
extern PwmOut left1;
extern PwmOut left2;
extern PwmOut right1;
extern PwmOut right2;

extern DigitalOut enableLeftMotor;
extern DigitalOut enableRightMotor; */

class Motor
{
    public:
        Motor( PinName f, PinName b, PinName e ) : 
            enableForw( f ), enableBack( b ), motorSpeed( e ), maxSpeed( 0.2 ), minSpeed(0.07)
        {
        }
    
        void backward( double voltage );
        void forward( double voltage );
        void brake();
        void coast();
        void move( double voltage );
        
    private:
        DigitalOut enableForw;
        DigitalOut enableBack;
        PwmOut motorSpeed;  
        const double maxSpeed;
        const double minSpeed;
};

//QEI leftWheel(

/*
inline void enableMotors(){
    enableLeftMotor.write(1);
    enableRightMotor.write(1);
}*/


#endif