Vejam ai essa merda

Dependencies:   HC_SR04_Ultrasonic_Library mbed

Files at this revision

API Documentation at this revision

Comitter:
Edgar2016
Date:
Wed Sep 21 18:43:01 2016 +0000
Commit message:
V? ai se v?

Changed in this revision

HC_SR04_Ultrasonic_Library.lib 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
sonar.cpp Show annotated file Show diff for this revision Revisions of this file
sonar.h 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_Ultrasonic_Library.lib	Wed Sep 21 18:43:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/ejteb/code/HC_SR04_Ultrasonic_Library/#e0f9c9fb4cf3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 21 18:43:01 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/abea610beb85
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sonar.cpp	Wed Sep 21 18:43:01 2016 +0000
@@ -0,0 +1,16 @@
+#include "sonar.h"
+#include "mbed.h"
+#include "ultrasonic.h"
+
+Sonar::Sonar():
+_ultrasonic(Sonar::trigger, Sonar::echo, Sonar::updateTime, Sonar::timeout)
+{ 
+
+   
+}
+float Sonar::lerDistancia(ultrasonic _ultrasonic){
+    
+    float distancia = _ultrasonic.getCurrentDistance();
+    return distancia;
+    
+} 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sonar.h	Wed Sep 21 18:43:01 2016 +0000
@@ -0,0 +1,26 @@
+#ifndef Sonar_H
+#define Sonar_H
+
+#include "mbed.h"
+#include "ultrasonic.h"
+
+class Sonar
+{
+    static const PinName trigger = D1; //Define o pino para o trigger 
+    static const PinName echo = D0; //Define o pino para o echo
+    static const float updateTime = .1;
+    static const float timeout = 1;
+   
+    //Inicializa o sensor nos pinos definidos acima
+    ultrasonic _ultrasonic;
+    
+public:
+    Sonar();
+    ~Sonar();
+    float lerDistancia(ultrasonic _ultrasonic);
+    
+protected:
+        
+};
+
+#endif
\ No newline at end of file