BERTL16 LineDrive

Dependencies:   Serial_HL mbed

Committer:
WelzAlex
Date:
Thu Jan 24 21:06:58 2019 +0000
Revision:
0:68b692bb433c
BERTL16Drive

Who changed what in which revision?

UserRevisionLine numberNew contents of line
WelzAlex 0:68b692bb433c 1 #include "dracuDrive.h"
WelzAlex 0:68b692bb433c 2 #include "mbed.h"
WelzAlex 0:68b692bb433c 3
WelzAlex 0:68b692bb433c 4
WelzAlex 0:68b692bb433c 5 dracuMotor::dracuMotor(PinName MotorEN, PinName MotorFOR , PinName MotorREV):
WelzAlex 0:68b692bb433c 6 motorEnabled(MotorEN), motorForward(MotorFOR), motorReverse(MotorREV)
WelzAlex 0:68b692bb433c 7 {
WelzAlex 0:68b692bb433c 8 motorEnabled = 0.0;
WelzAlex 0:68b692bb433c 9 }
WelzAlex 0:68b692bb433c 10 void dracuMotor::Speed(float speed)
WelzAlex 0:68b692bb433c 11 {
WelzAlex 0:68b692bb433c 12 if (speed <0)
WelzAlex 0:68b692bb433c 13 {
WelzAlex 0:68b692bb433c 14 motorForward =0;
WelzAlex 0:68b692bb433c 15 motorReverse =1;
WelzAlex 0:68b692bb433c 16 motorEnabled = (-1)*speed;
WelzAlex 0:68b692bb433c 17 }
WelzAlex 0:68b692bb433c 18 else
WelzAlex 0:68b692bb433c 19 {
WelzAlex 0:68b692bb433c 20 motorForward =1;
WelzAlex 0:68b692bb433c 21 motorReverse =0;
WelzAlex 0:68b692bb433c 22 motorEnabled = speed;
WelzAlex 0:68b692bb433c 23 }
WelzAlex 0:68b692bb433c 24 _speed = speed;
WelzAlex 0:68b692bb433c 25 }
WelzAlex 0:68b692bb433c 26
WelzAlex 0:68b692bb433c 27 dracuMotor::operator float ()
WelzAlex 0:68b692bb433c 28 {
WelzAlex 0:68b692bb433c 29 return _speed;
WelzAlex 0:68b692bb433c 30 }