changed range conditions

Dependents:   theRobot3

Fork of HCSR04 by stephen smitherman

Revision:
3:89f21eb28e13
Parent:
2:3ebde19131af
--- 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{