Only imu output

Dependencies:   Servo mbed

Fork of FYDP_Final2 by Mark Vandermeulen

Committer:
majik
Date:
Sat Mar 21 21:31:29 2015 +0000
Revision:
0:21019d94ad33
Both IMUs work now

Who changed what in which revision?

UserRevisionLine numberNew contents of line
majik 0:21019d94ad33 1 #include "motors.h"
majik 0:21019d94ad33 2
majik 0:21019d94ad33 3 Motors::Motors(TB6612 * L, TB6612 * R, PinName STBY):
majik 0:21019d94ad33 4 Left(L), Right(R), enable(STBY)
majik 0:21019d94ad33 5 {
majik 0:21019d94ad33 6 enable = 1;
majik 0:21019d94ad33 7 }
majik 0:21019d94ad33 8
majik 0:21019d94ad33 9 void Motors::flip()
majik 0:21019d94ad33 10 {
majik 0:21019d94ad33 11 TB6612 * temp = Left;
majik 0:21019d94ad33 12 Left = Right;
majik 0:21019d94ad33 13 Right = temp;
majik 0:21019d94ad33 14
majik 0:21019d94ad33 15 Left->scale *= -1;
majik 0:21019d94ad33 16 Right->scale *= -1;
majik 0:21019d94ad33 17 }
majik 0:21019d94ad33 18 void Motors::reverse(bool m)
majik 0:21019d94ad33 19 {
majik 0:21019d94ad33 20 if(m)
majik 0:21019d94ad33 21 Right->scale *= -1; //reverse right motor
majik 0:21019d94ad33 22 else
majik 0:21019d94ad33 23 Left->scale *= -1; //reverse left motor
majik 0:21019d94ad33 24 }
majik 0:21019d94ad33 25
majik 0:21019d94ad33 26 //TODO: write in a function that automatically sets the motors to be oriented properly. Use the
majik 0:21019d94ad33 27 //gyroscopes and accelerometer to do this.