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
Diff: mtrctl.cpp
- Revision:
- 1:681973914ddd
- Parent:
- 0:4fc76af15d0e
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 {