MTRCTL - Sets initial frequency of DC motors. - Controls motor speed according to IC specifications. - Handles motors in order to help the car during curved paths.
Dependents: frdm_MasterVehicle
Revision 1:681973914ddd, committed 2014-10-17
- Comitter:
- JalilChavez
- Date:
- Fri Oct 17 21:48:31 2014 +0000
- Parent:
- 0:4fc76af15d0e
- Commit message:
- - Corrected differential speed algorithm
Changed in this revision
mtrctl.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4fc76af15d0e -r 681973914ddd mtrctl.cpp --- a/mtrctl.cpp Tue Oct 14 03:55:04 2014 +0000 +++ b/mtrctl.cpp Fri Oct 17 21:48:31 2014 +0000 @@ -36,7 +36,7 @@ { if( u16InPwr < MAX_POWER ) { - MTRCTL__xPwm[u8MotorIndex].write(((float)u16InPwr/MAX_POWER)*(MTRCTL__MaxSpeed)); + MTRCTL__xPwm[u8MotorIndex].write(((float)u16InPwr/MAX_POWER)*((float)MTRCTL__MaxSpeed/MAX_POWER)); } else {