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.
Dependents: harurobo1006 harurobo_1026
Fork of EC by
Diff: SpeedController.cpp
- Revision:
- 17:e0b465d9b579
- Parent:
- 16:14d05ae8d566
- Child:
- 18:31058ca8fc8a
--- a/SpeedController.cpp Mon Apr 10 10:14:38 2017 +0000 +++ b/SpeedController.cpp Tue Apr 11 07:51:08 2017 +0000 @@ -21,7 +21,7 @@ diff_old=diff; if(out_duty>0.1)out_duty=0.1; if(out_duty<-0.1)out_duty=-0.1; - out+=out_duty; + if((duty>0)&&(duty<0.95)) out+=out_duty; duty=0.0001*out+target_omega/C; if(duty<-0.95)duty=-0.95; else if(duty>0.95)duty=0.95; @@ -113,7 +113,7 @@ diff_old=diff; if(out_duty>0.01)out_duty=0.01; if(out_duty<-0.01)out_duty=-0.01; - out+=out_duty; + if((duty>0)&&(duty<0.95)) out+=out_duty; duty=0.0001*out/*+target_RPM/C*/; turnF(duty); } @@ -128,7 +128,7 @@ diff_old=diff; if(out_duty>0.001)out_duty=0.001; if(out_duty<-0.001)out_duty=-0.001; - out+=out_duty; + if((duty>0)&&(duty<0.95)) out+=out_duty; duty=0.001*out; turnF(duty); }