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:
- 13:5601fedf0e12
- Parent:
- 11:5f05b14649ee
- Child:
- 14:d059d99e9b5e
--- a/MotorControl.cpp Tue Jul 02 21:57:47 2019 +0000 +++ b/MotorControl.cpp Wed Jul 03 08:32:41 2019 +0000 @@ -27,6 +27,9 @@ extern float parB; extern float parC; +extern bool nFaultFlag; + + void MotorButton() { mkOn=0; @@ -193,14 +196,19 @@ s = (curTarget-d2)/targetDis; abs_error = abs(curTarget-d2); - bt.printf("%dth: %1.4f\r\n",onewayNum,s); + bt.printf("%dth: %1.4f\r\n",onewayNum,s); + if(!nFaultFlag) + { + enable = 0; + nreset = 0; + p1=0; + p2=0; + } if(s>=0) { enable = 1; nreset = 1; p1 = 0; -// p2 = 0; //(s>0.7f)?s:0.7f; -// wait(0.01); p2 = 1; } @@ -208,9 +216,7 @@ { enable = 1; nreset = 1; -// p1 = 0; //(s<-0.7f)?(-1*s):0.7f; p2 = 0; -// wait(0.01); p1 = 1; }