Sonar Simples

Dependencies:   HCSR04

Committer:
Edgar2016
Date:
Thu Sep 29 16:49:08 2016 +0000
Revision:
0:e2112f4ac360
Sonar Simples

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Edgar2016 0:e2112f4ac360 1 #ifndef Sonar_H
Edgar2016 0:e2112f4ac360 2 #define Sonar_H
Edgar2016 0:e2112f4ac360 3
Edgar2016 0:e2112f4ac360 4 #include "mbed.h"
Edgar2016 0:e2112f4ac360 5 #include "hcsr04.h"
Edgar2016 0:e2112f4ac360 6
Edgar2016 0:e2112f4ac360 7 class Sonar
Edgar2016 0:e2112f4ac360 8 {
Edgar2016 0:e2112f4ac360 9 static const PinName trigger = D1; //Define o pino para o trigger
Edgar2016 0:e2112f4ac360 10 static const PinName echo = D0; //Define o pino para o echo
Edgar2016 0:e2112f4ac360 11
Edgar2016 0:e2112f4ac360 12 //Inicializa o sensor nos pinos definidos acima
Edgar2016 0:e2112f4ac360 13 HCSR04 _HCSR04;
Edgar2016 0:e2112f4ac360 14
Edgar2016 0:e2112f4ac360 15 public:
Edgar2016 0:e2112f4ac360 16 Sonar();
Edgar2016 0:e2112f4ac360 17 ~Sonar();
Edgar2016 0:e2112f4ac360 18 float lerDistancia(HCSR04 _HCSR04);
Edgar2016 0:e2112f4ac360 19
Edgar2016 0:e2112f4ac360 20
Edgar2016 0:e2112f4ac360 21 };
Edgar2016 0:e2112f4ac360 22
Edgar2016 0:e2112f4ac360 23 #endif