Code for our FYDP -only one IMU works right now -RTOS is working
Diff: motors/motors.cpp
- Revision:
- 0:964eb6a2ef00
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/motors/motors.cpp Wed Mar 18 22:23:48 2015 +0000 @@ -0,0 +1,27 @@ +#include "motors.h" + +Motors::Motors(TB6612 * L, TB6612 * R, PinName STBY): + Left(L), Right(R), enable(STBY) +{ + enable = 1; +} + +void Motors::flip() +{ + TB6612 * temp = Left; + Left = Right; + Right = temp; + + Left->scale *= -1; + Right->scale *= -1; +} +void Motors::reverse(bool m) +{ + if(m) + Right->scale *= -1; //reverse right motor + else + Left->scale *= -1; //reverse left motor +} + +//TODO: write in a function that automatically sets the motors to be oriented properly. Use the +//gyroscopes and accelerometer to do this. \ No newline at end of file