Programa exemplo para biblioteca HCSR04

Dependencies:   HC-SR04 mbed

Files at this revision

API Documentation at this revision

Comitter:
Nestordp
Date:
Thu Feb 05 19:04:15 2015 +0000
Commit message:
Programa exemplo biblioteca HCSR04

Changed in this revision

HC-SR04.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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HC-SR04.lib	Thu Feb 05 19:04:15 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/Nestordp/code/HC-SR04/#d1d7bb1c1f6c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Feb 05 19:04:15 2015 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+#include "HCSR04.h"
+
+DigitalOut myled(LED1);
+Serial pc(USBTX,USBRX);     
+
+HCSR04 sonar(A2, D12);
+
+int main() {
+    printf("INICIO PROGRAMA\n");
+    while(1) {
+        printf("Distancia detectada pelo sensor Frente %.2f cm \n", sonar.getCm()); 
+        wait_ms(1000);
+        printf("Distancia detectada pelo sensor Frente %.2f in \n", sonar.getIn()); 
+        wait_ms(1000);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Feb 05 19:04:15 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file