HCSR04

Dependencies:   HCSR04 mbed

Files at this revision

API Documentation at this revision

Comitter:
srsmitherman
Date:
Tue Mar 11 21:20:40 2014 +0000
Commit message:
Test Program for HCSR04

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 f91b4b2acbe1 HCSR04.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04.lib	Tue Mar 11 21:20:40 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/srsmitherman/code/HCSR04/#3ebde19131af
diff -r 000000000000 -r f91b4b2acbe1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 11 21:20:40 2014 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "HCSR04.h"
+
+DigitalOut myled(LED1);
+Serial pc(USBTX,USBRX);
+HCSR04 ultra(p12,p11);
+
+float range=0;
+
+int main() {
+    
+        
+    pc.printf("Program Start\n");    
+    while(1) {
+        
+        ultra.startMeas();
+        
+        wait(0.2);
+        
+        
+        if( ultra.getMeas(range) == RANGE_MEAS_VALID)
+        {
+            pc.printf("Range - %f\n\r",  range);
+        }
+    }
+}
diff -r 000000000000 -r f91b4b2acbe1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 11 21:20:40 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8e73be2a2ac1
\ No newline at end of file