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:
- 11:5f05b14649ee
- Parent:
- 10:3fcaf50f528f
- Child:
- 13:5601fedf0e12
diff -r 3fcaf50f528f -r 5f05b14649ee MotorControl.cpp --- a/MotorControl.cpp Tue Jul 02 04:44:35 2019 +0000 +++ b/MotorControl.cpp Tue Jul 02 21:34:50 2019 +0000 @@ -139,7 +139,7 @@ void ControlAng() { - + bt.putc('1'); float d1 = disSensor.read(); float d2 = parA*d1*d1+parB*d1+parC; float ref_d = targetDis-d2; @@ -179,7 +179,8 @@ void MkAction() { - +// bt.putc('3'); + float d1 = disSensor.read(); float d2 = parA*d1*d1+parB*d1+parC; @@ -192,14 +193,14 @@ s = (curTarget-d2)/targetDis; abs_error = abs(curTarget-d2); - + bt.printf("%dth: %1.4f\r\n",onewayNum,s); if(s>=0) { enable = 1; nreset = 1; p1 = 0; - p2 = 0; //(s>0.7f)?s:0.7f; - wait(0.01); +// p2 = 0; //(s>0.7f)?s:0.7f; +// wait(0.01); p2 = 1; } @@ -207,9 +208,9 @@ { enable = 1; nreset = 1; - p1 = 0; //(s<-0.7f)?(-1*s):0.7f; +// p1 = 0; //(s<-0.7f)?(-1*s):0.7f; p2 = 0; - wait(0.01); +// wait(0.01); p1 = 1; }