medir distancia con sr04

Dependencies:   HCSR04 mbed

Files at this revision

API Documentation at this revision

Comitter:
SolManB
Date:
Sun Dec 04 21:03:40 2016 +0000
Commit message:
ultrasonico

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 9f77dc0f89b4 HCSR04.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR04.lib	Sun Dec 04 21:03:40 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/grantphillips/code/HCSR04/#8286d0de19ce
diff -r 000000000000 -r 9f77dc0f89b4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Dec 04 21:03:40 2016 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+#include "HCSR04.h"
+ 
+HCSR04 distance(p21,p18);
+Serial pc(USBTX,USBRX);
+ 
+int main() {
+ while(1){
+    float m=distance.read_cm();
+    pc.printf("Distance = %f (cm)\n", m); 
+     }
+  }
diff -r 000000000000 -r 9f77dc0f89b4 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Dec 04 21:03:40 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file