BERTL16 LineDrive

Dependencies:   Serial_HL mbed

dracuDrive.cpp

Committer:
WelzAlex
Date:
2019-01-24
Revision:
0:68b692bb433c

File content as of revision 0:68b692bb433c:

#include "dracuDrive.h"
#include "mbed.h"


dracuMotor::dracuMotor(PinName MotorEN, PinName MotorFOR , PinName MotorREV):
    motorEnabled(MotorEN), motorForward(MotorFOR), motorReverse(MotorREV)
    {
        motorEnabled = 0.0;
    }
void dracuMotor::Speed(float speed)
{
    if (speed <0)
    {
        motorForward =0;
        motorReverse =1;
        motorEnabled = (-1)*speed;
    }
    else
    {
        motorForward =1;
        motorReverse =0;
        motorEnabled = speed;
    }
    _speed = speed;
}

dracuMotor::operator float ()
{
      return _speed;
}