Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo
motor_controller.cpp
- Committer:
- rkk
- Date:
- 2014-02-01
- Revision:
- 12:7eeb29892625
- Parent:
- 11:8ec915eb70f6
File content as of revision 12:7eeb29892625:
#include "motor_controller.h"
PololuMController::PololuMController(PinName pwmport, PinName A, PinName B)
:pwm(pwmport),outA(A),outB(B)
{
outA.write(0);
outB.write(1);
}
void PololuMController::setpolarspeed(float speed)
{
if (speed>=0) {
outA.write(0);
outB.write(1);
pwm.write(abs(speed));
} else {
outA.write(1);
outB.write(0);
pwm.write(abs(speed));
}
return;
}