done
Diff: HCSR04.cpp
- Revision:
- 5:4ec03bbadf69
- Parent:
- 3:12d6d751f4fc
--- 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