Sonar Simples
Dependencies: HCSR04
sonar.cpp@0:e2112f4ac360, 2016-09-29 (annotated)
- Committer:
- Edgar2016
- Date:
- Thu Sep 29 16:49:08 2016 +0000
- Revision:
- 0:e2112f4ac360
Sonar Simples
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Edgar2016 | 0:e2112f4ac360 | 1 | #include "sonar.h" |
Edgar2016 | 0:e2112f4ac360 | 2 | #include "mbed.h" |
Edgar2016 | 0:e2112f4ac360 | 3 | #include "hcsr04.h" |
Edgar2016 | 0:e2112f4ac360 | 4 | |
Edgar2016 | 0:e2112f4ac360 | 5 | Sonar::Sonar(): |
Edgar2016 | 0:e2112f4ac360 | 6 | _ultrasonic(Sonar::trigger, Sonar::echo){ |
Edgar2016 | 0:e2112f4ac360 | 7 | } |
Edgar2016 | 0:e2112f4ac360 | 8 | |
Edgar2016 | 0:e2112f4ac360 | 9 | float Sonar::lerDistancia(HCSR04 _HCSR04){ |
Edgar2016 | 0:e2112f4ac360 | 10 | _HCSR04.distance(); |
Edgar2016 | 0:e2112f4ac360 | 11 | float distance = _HCSR04; |
Edgar2016 | 0:e2112f4ac360 | 12 | return distance; |
Edgar2016 | 0:e2112f4ac360 | 13 | } |