![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Sonar
Dependencies: mbed SDHC_FileSystem DS18B20_1wire HC_SR04_Ultrasonic_Library
Sonar/sonar.h@0:a449396d32de, 2016-09-22 (annotated)
- Committer:
- igorsilvati
- Date:
- Thu Sep 22 16:18:36 2016 +0000
- Revision:
- 0:a449396d32de
Pega ai
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igorsilvati | 0:a449396d32de | 1 | #ifndef Sonar_H |
igorsilvati | 0:a449396d32de | 2 | #define Sonar_H |
igorsilvati | 0:a449396d32de | 3 | |
igorsilvati | 0:a449396d32de | 4 | #include "mbed.h" |
igorsilvati | 0:a449396d32de | 5 | #include "ultrasonic.h" |
igorsilvati | 0:a449396d32de | 6 | |
igorsilvati | 0:a449396d32de | 7 | class Sonar |
igorsilvati | 0:a449396d32de | 8 | { |
igorsilvati | 0:a449396d32de | 9 | static const PinName trigger = D1; //Define o pino para o trigger |
igorsilvati | 0:a449396d32de | 10 | static const PinName echo = D0; //Define o pino para o echo |
igorsilvati | 0:a449396d32de | 11 | static const float updateTime = .1; |
igorsilvati | 0:a449396d32de | 12 | static const float timeout = 1; |
igorsilvati | 0:a449396d32de | 13 | |
igorsilvati | 0:a449396d32de | 14 | //Inicializa o sensor nos pinos definidos acima |
igorsilvati | 0:a449396d32de | 15 | ultrasonic _ultrasonic; |
igorsilvati | 0:a449396d32de | 16 | |
igorsilvati | 0:a449396d32de | 17 | public: |
igorsilvati | 0:a449396d32de | 18 | Sonar(); |
igorsilvati | 0:a449396d32de | 19 | ~Sonar(); |
igorsilvati | 0:a449396d32de | 20 | float lerDistancia(ultrasonic _ultrasonic); |
igorsilvati | 0:a449396d32de | 21 | |
igorsilvati | 0:a449396d32de | 22 | protected: |
igorsilvati | 0:a449396d32de | 23 | |
igorsilvati | 0:a449396d32de | 24 | }; |
igorsilvati | 0:a449396d32de | 25 | |
igorsilvati | 0:a449396d32de | 26 | #endif |