changes to motor library
Fork of motor by
Diff: motor.cpp
- Revision:
- 1:09226806dd15
- Parent:
- 0:b0476dcfa14c
- Child:
- 2:cc8ddc587af7
--- a/motor.cpp Tue Oct 18 14:57:55 2016 +0000 +++ b/motor.cpp Fri Oct 21 13:14:39 2016 +0000 @@ -20,7 +20,7 @@ void cornerRight(float speed); -//int cornerPwmControl;// this sets the cornering percentage ratio. value between 100 and 0. +int cornerPwmControl;// this sets the cornering percentage ratio. value between 1 and 0. // 100 means both motors run at the same speed. 0 means that one motor turns off. @@ -156,6 +156,10 @@ void cornerLeft(float speed) {// when cornering left the left motor slows down more than the right hand side // may just replace with ACC and DECC + w1 = speed + diff; + w2 = speed-diff; + TFC_SetMotorPWM(w2,w1); //temperary values + TFC_SetMotorPWM(speed,speed*cornerPwmControl);//temperary values return; @@ -164,7 +168,10 @@ void cornerRight(float speed) { // may need to put deceleration control within here. // may just replace with ACC and DECC - TFC_SetMotorPWM(speed*cornerPwmControl,speed); //temperary values + float diff = speed*cornerPwmControl; + w1 = speed + diff; + w2 = speed-diff; + TFC_SetMotorPWM(w1,w2); //temperary values return; }