Aqueles Que Não Sabem O Que Fazem
/
SonarSimplesb
Sonar Simples
Fork of SonarSimples by
sonar.h@3:09347b9e1264, 2016-09-30 (annotated)
- Committer:
- Edgar2016
- Date:
- Fri Sep 30 11:40:55 2016 +0000
- Revision:
- 3:09347b9e1264
- Parent:
- 1:9f0f27bc5f52
novo
Who changed what in which revision?
User | Revision | Line number | New 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 | 1:9f0f27bc5f52 | 18 | float lerDistancia(HCSR04 _HCSR04); //Método para ler distancia |
Edgar2016 | 0:e2112f4ac360 | 19 | }; |
Edgar2016 | 0:e2112f4ac360 | 20 | |
Edgar2016 | 0:e2112f4ac360 | 21 | #endif |