Six crescent shaped legs

Dependencies:   mbed

Committer:
sim642
Date:
Tue Apr 12 13:12:49 2016 +0000
Revision:
12:8de7f5d56fe4
Parent:
9:31e850271c4a
Make EncoderMotor own its own speed smoother

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sim642 2:cf0147952fb9 1 #include "Motor.hpp"
sim642 2:cf0147952fb9 2 #include <cmath>
sim642 2:cf0147952fb9 3
sim642 12:8de7f5d56fe4 4 Motor::Motor(MotorData nData) :
sim642 12:8de7f5d56fe4 5 data(nData),
sim642 12:8de7f5d56fe4 6 pwm(data.pwmPin),
sim642 12:8de7f5d56fe4 7 dir1(data.dir1Pin), dir2(data.dir2Pin)
sim642 2:cf0147952fb9 8 {
sim642 2:cf0147952fb9 9 drive(0);
sim642 2:cf0147952fb9 10 }
sim642 2:cf0147952fb9 11
sim642 2:cf0147952fb9 12 void Motor::drive(float power)
sim642 2:cf0147952fb9 13 {
sim642 7:8dcdb39efc0e 14 pwm = std::abs(power);
sim642 2:cf0147952fb9 15 dir1 = !(dir2 = (power >= 0));
sim642 2:cf0147952fb9 16 }