Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
Dependents: GT_MOTOR_24NM_V03 GT_MOTOR_24NM_V03_PT1000CalTemp
Diff: PositionSensor/PositionSensor.cpp
- Revision:
- 13:a3fa0a31b114
- Parent:
- 12:c473a25f54f7
- Child:
- 14:80ce59119d93
diff -r c473a25f54f7 -r a3fa0a31b114 PositionSensor/PositionSensor.cpp --- a/PositionSensor/PositionSensor.cpp Sun May 22 03:38:19 2016 +0000 +++ b/PositionSensor/PositionSensor.cpp Sun May 22 03:47:40 2016 +0000 @@ -139,9 +139,7 @@ return elec; } -float PositionSensorEncoder::GetElecVelocity(){ - return _ppairs*GetMechVelocity(); - } + float PositionSensorEncoder::GetMechVelocity(){ float out = 0; @@ -157,18 +155,15 @@ out = meas; } - /* - if(abs(vel) < 2.0f){ - vel = 0; - } - */ vel_old = meas; - - //out = .5f*out + .5f*out_old; out_old = out; return out; } - + +float PositionSensorEncoder::GetElecVelocity(){ + return _ppairs*GetMechVelocity(); + } + void PositionSensorEncoder::ZeroEncoderCount(void){ if (ZSense->read() == 1 & flag == 0){ if (ZSense->read() == 1){