done

Dependents:   AwesomeAlarm_BLE

Files at this revision

API Documentation at this revision

Comitter:
yungsung
Date:
Thu Jan 09 19:18:48 2020 +0000
Parent:
4:be89035b2c42
Commit message:
done

Changed in this revision

HCSR04.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r be89035b2c42 -r 4ec03bbadf69 HCSR04.cpp
--- a/HCSR04.cpp	Tue May 16 01:53:19 2017 +0000
+++ b/HCSR04.cpp	Thu Jan 09 19:18:48 2020 +0000
@@ -41,7 +41,7 @@
     }
 
 float HCSR04::getCm(void){
-    distcm = readEcho()/58;
+    distcm = readEcho()/58.2;
     return distcm;
     }
 
@@ -50,7 +50,9 @@
     return distin;
     }
 
-float HCSR04::readEcho(void){     
+float HCSR04::readEcho(void){      
+    _t=0;                       //Inicio do trigger
+    wait_us(5);                //10us de pulso    
     _t=1;                       //Inicio do trigger
     wait_us(10);                //10us de pulso
     _t=0;                       //Fim do trigger