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
Diff: MotorControl.cpp
- Revision:
- 5:6bb52b2a79bf
- Parent:
- 4:bf4ad2079096
- Child:
- 8:a435e7aa7a02
--- a/MotorControl.cpp Fri Dec 21 20:39:24 2018 +0000 +++ b/MotorControl.cpp Wed Dec 26 10:58:58 2018 +0000 @@ -21,10 +21,9 @@ extern int onewayNum; extern bool mkOn; - -#define parA 347.44f // parmeter of equation (values of distance sensor) -#define parB -1*481.16f -#define parC 155.42f +#define parA 343.75f // parmeter of equation (values of distance sensor) +#define parB -1*508.08f +#define parC 166.67f void MotorButton() @@ -157,7 +156,7 @@ float s; float abs_error; - curTarget = (onewayNum%2==0)? targetDis: 1.2f ; // initial angle + curTarget = (onewayNum%2==0)? targetDis: 0.0f ; // initial angle s = (curTarget-d2)/targetDis; abs_error = abs(curTarget-d2); @@ -177,7 +176,7 @@ p2 = 0; } - if (abs_error <0.5f) + if (abs_error <0.7f) { onewayNum = onewayNum +1;