Example for utrasonic ranging sensor

Dependencies:   HCSR04 mbed

Fork of Nucleo_Ultrasonic-HCSR4 by Didier Donsez

Files at this revision

API Documentation at this revision

Comitter:
donsez
Date:
Sun Mar 29 09:53:55 2015 +0000
Commit message:
test of ultrasonic library for HC-SR04

Changed in this revision

HCSR04.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 65d91f9edab4 HCSR04.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04.lib	Sun Mar 29 09:53:55 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/antoniolinux/code/HCSR04/#86b2086be101
diff -r 000000000000 -r 65d91f9edab4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Mar 29 09:53:55 2015 +0000
@@ -0,0 +1,15 @@
+/* EXAMPLE */
+#include "mbed.h"
+#include "hcsr04.h"
+
+//D12 TRIGGER D11 ECHO
+HCSR04 sensor(D12, D11); 
+int main() {
+    while(1) {
+        
+     long distance = sensor.distance();   
+      printf("distance  %d  \n",distance);
+      wait(1.0); // 1 sec  
+        
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 65d91f9edab4 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Mar 29 09:53:55 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file