Six crescent shaped legs

Dependencies:   mbed

Motor.cpp

Committer:
sim642
Date:
2016-06-21
Revision:
47:4f418a4b0051
Parent:
12:8de7f5d56fe4

File content as of revision 47:4f418a4b0051:

#include "Motor.hpp"
#include <cmath>

Motor::Motor(MotorData nData) :
    data(nData),
    pwm(data.pwmPin),
    dir1(data.dir1Pin), dir2(data.dir2Pin)
{
    drive(0);
}

void Motor::drive(float power)
{
    pwm = std::abs(power);
    dir1 = !(dir2 = (power >= 0));
}