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.
Fork of HCSR04 by
Revision 3:89f21eb28e13, committed 2014-04-15
- Comitter:
- Fairy_Paolina
- Date:
- Tue Apr 15 16:51:11 2014 +0000
- Parent:
- 2:3ebde19131af
- Commit message:
- changed range;
Changed in this revision
| HCSR04.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3ebde19131af -r 89f21eb28e13 HCSR04.cpp
--- a/HCSR04.cpp Thu Dec 12 17:22:48 2013 +0000
+++ b/HCSR04.cpp Tue Apr 15 16:51:11 2014 +0000
@@ -67,6 +67,9 @@
rRangeMeters = (float)dTime_us * SPEED_OF_SOUND / 2000000.0 * MTRS_TO_INCH;
status = RANGE_MEAS_INVALID;
+
+ if(rRangeMeters > 200 || rRangeMeters < 3 ) return RANGE_MEAS_INVALID;
+
return RANGE_MEAS_VALID;
}else{
