Ultrasonico

Dependencies:   Ping mbed

Files at this revision

API Documentation at this revision

Comitter:
DnPlas
Date:
Tue Oct 14 23:30:29 2014 +0000
Commit message:
Mensaje

Changed in this revision

Ping.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 892136a9b384 Ping.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Ping.lib	Tue Oct 14 23:30:29 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/rosienej/code/Ping/#6996f66161d7
diff -r 000000000000 -r 892136a9b384 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 14 23:30:29 2014 +0000
@@ -0,0 +1,29 @@
+/*El siguiente programa leerá e imprimirá valores obtenidos por
+un sensor ultrasónico Ping ))) de Parallax.
+ARDUINO - FRDM http://www.haoyuelectronics.com/ebay/FRDM-KL25Z/5.jpg
+FRDM PIN http://developer.mbed.org/media/uploads/rikabel/kl25z-pinout-revised.jpg
+Daniela Plascencia*/
+
+//-------LIBRARIES-------
+#include "mbed.h"
+#include "Ping.h"
+
+//---------I/O PINS--------
+Ping sensor(D7);
+Serial pc(USBTX, USBRX);
+
+//--------VARIABLES--------
+float distancia=0;
+
+//--------MAIN-------------
+int main ()
+{
+    while (1) {
+        sensor.Send();
+        wait_ms(30);
+        distancia = sensor.Read_cm();
+        pc.printf("Distancia: %f\n", distancia);
+        wait(1);
+    }
+}
+
diff -r 000000000000 -r 892136a9b384 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 14 23:30:29 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file