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: EC.cpp
- Revision:
- 11:b96009f8b9fd
- Parent:
- 10:216d5a573dc7
- Child:
- 26:45a53e3c81b1
--- a/EC.cpp Tue Nov 29 12:45:45 2016 +0000
+++ b/EC.cpp Tue Dec 13 07:38:51 2016 +0000
@@ -41,13 +41,21 @@
void Ec::upZ(){
if(first==false){
+ static int res_count;
rev++;
first=true;
now_time=timer.read();
RPM=60/(now_time-old_time);
if((RPM_old-RPM)>RPM_th){
- printf("\r\n CAUTION : speed downed drastically\r\n");
- NVIC_SystemReset();
+ if(res_count >= 5){
+ printf("\r\n CAUTION : speed downed drastically\r\n");
+ NVIC_SystemReset();
+ res_count=0;
+ }else{
+ res_count++;
+ }
+ }else{
+ res_count=0;
}
RPM_old=RPM;
old_time=timer.read();
