the fish that looks like a jet

Dependencies:   ADXL345 ADXL345_I2C IMUfilter ITG3200 mbed Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers motor_controller.cpp Source File

motor_controller.cpp

00001 #include "motor_controller.h"
00002 
00003 PololuMController::PololuMController(PinName pwmport, PinName A, PinName B)
00004     :pwm(pwmport),outA(A),outB(B)
00005 {
00006     outA.write(0);
00007     outB.write(1);
00008 }
00009 
00010 void PololuMController::setpolarspeed(float speed)
00011 {
00012     if (speed>=0) {
00013         outA.write(0);
00014         outB.write(1);
00015         pwm.write(abs(speed));
00016     } else {
00017         outA.write(1);
00018         outB.write(0);
00019         pwm.write(abs(speed));
00020     }
00021     return;
00022 }