Vejam ai essa merda
Dependencies: HC_SR04_Ultrasonic_Library mbed
sonar.h@0:498cbd4c79e9, 2016-09-21 (annotated)
- Committer:
- Edgar2016
- Date:
- Wed Sep 21 18:43:01 2016 +0000
- Revision:
- 0:498cbd4c79e9
V? ai se v?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Edgar2016 | 0:498cbd4c79e9 | 1 | #ifndef Sonar_H |
Edgar2016 | 0:498cbd4c79e9 | 2 | #define Sonar_H |
Edgar2016 | 0:498cbd4c79e9 | 3 | |
Edgar2016 | 0:498cbd4c79e9 | 4 | #include "mbed.h" |
Edgar2016 | 0:498cbd4c79e9 | 5 | #include "ultrasonic.h" |
Edgar2016 | 0:498cbd4c79e9 | 6 | |
Edgar2016 | 0:498cbd4c79e9 | 7 | class Sonar |
Edgar2016 | 0:498cbd4c79e9 | 8 | { |
Edgar2016 | 0:498cbd4c79e9 | 9 | static const PinName trigger = D1; //Define o pino para o trigger |
Edgar2016 | 0:498cbd4c79e9 | 10 | static const PinName echo = D0; //Define o pino para o echo |
Edgar2016 | 0:498cbd4c79e9 | 11 | static const float updateTime = .1; |
Edgar2016 | 0:498cbd4c79e9 | 12 | static const float timeout = 1; |
Edgar2016 | 0:498cbd4c79e9 | 13 | |
Edgar2016 | 0:498cbd4c79e9 | 14 | //Inicializa o sensor nos pinos definidos acima |
Edgar2016 | 0:498cbd4c79e9 | 15 | ultrasonic _ultrasonic; |
Edgar2016 | 0:498cbd4c79e9 | 16 | |
Edgar2016 | 0:498cbd4c79e9 | 17 | public: |
Edgar2016 | 0:498cbd4c79e9 | 18 | Sonar(); |
Edgar2016 | 0:498cbd4c79e9 | 19 | ~Sonar(); |
Edgar2016 | 0:498cbd4c79e9 | 20 | float lerDistancia(ultrasonic _ultrasonic); |
Edgar2016 | 0:498cbd4c79e9 | 21 | |
Edgar2016 | 0:498cbd4c79e9 | 22 | protected: |
Edgar2016 | 0:498cbd4c79e9 | 23 | |
Edgar2016 | 0:498cbd4c79e9 | 24 | }; |
Edgar2016 | 0:498cbd4c79e9 | 25 | |
Edgar2016 | 0:498cbd4c79e9 | 26 | #endif |