My modifications/additions to the code

Dependencies:   ADXL345 ADXL345_I2C IMUfilter ITG3200 Servo fishgait mbed-rtos mbed pixy_cam

Fork of robotic_fish_ver_4_8 by jetfishteam

Committer:
sandwich
Date:
Fri Jul 11 14:30:36 2014 +0000
Revision:
25:4f2f441eceec
Parent:
12:7eeb29892625
latest revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sandwich 0:ff9bc5f69c57 1 #include "motor_controller.h"
sandwich 7:e005cfaff8d1 2
sandwich 0:ff9bc5f69c57 3 PololuMController::PololuMController(PinName pwmport, PinName A, PinName B)
rkk 12:7eeb29892625 4 :pwm(pwmport),outA(A),outB(B)
rkk 12:7eeb29892625 5 {
rkk 11:8ec915eb70f6 6 outA.write(0);
rkk 11:8ec915eb70f6 7 outB.write(1);
sandwich 0:ff9bc5f69c57 8 }
sandwich 0:ff9bc5f69c57 9
sandwich 0:ff9bc5f69c57 10 void PololuMController::setpolarspeed(float speed)
sandwich 0:ff9bc5f69c57 11 {
rkk 12:7eeb29892625 12 if (speed>=0) {
rkk 11:8ec915eb70f6 13 outA.write(0);
rkk 11:8ec915eb70f6 14 outB.write(1);
rkk 11:8ec915eb70f6 15 pwm.write(abs(speed));
rkk 12:7eeb29892625 16 } else {
rkk 11:8ec915eb70f6 17 outA.write(1);
rkk 11:8ec915eb70f6 18 outB.write(0);
rkk 11:8ec915eb70f6 19 pwm.write(abs(speed));
sandwich 0:ff9bc5f69c57 20 }
sandwich 0:ff9bc5f69c57 21 return;
sandwich 0:ff9bc5f69c57 22 }