Library used to operate the HCSR04 Ranging Module used in our project.

Fork of HCSR04 by Awadh Al Shukaili

Revision:
1:e0fdfb5d2b93
Parent:
0:0bda99bb39a4
--- a/HCSR04.cpp	Tue Oct 18 14:32:12 2011 +0000
+++ b/HCSR04.cpp	Fri Apr 29 01:56:57 2016 +0000
@@ -27,15 +27,12 @@
 //return distance to nearest obstacle or returns -1 
 //if no obstacle within range
 //set sys to cm or inch accordingly
-long HCSR04::distance(int sys){
+long HCSR04::distance(void){
     duration = echo_duration();
     if(duration > 30000)
-        return -1;
+        return 1000;
     distacne_cm = duration /29 / 2 ;
     distance_inc = duration / 74 / 2;
-    if (sys)
-        return distacne_cm;
-    else
-        return distance_inc;
+    return distacne_cm;
 }