HCSR04 - Mehmet Akif Arvas
Diff: hcsr04.cpp
- Revision:
- 1:f746a7bb4e54
- Parent:
- 0:86b2086be101
--- a/hcsr04.cpp Mon Apr 14 08:23:09 2014 +0000 +++ b/hcsr04.cpp Tue Jul 06 10:17:17 2021 +0000 @@ -4,7 +4,7 @@ *HCSR04.cpp */ HCSR04::HCSR04(PinName t, PinName e) : trig(t), echo(e) {} - long HCSR04::echo_duration() { + int HCSR04::echo_sure() { timer.reset(); //reset timer trig=0; // trigger low @@ -21,9 +21,9 @@ } //return distance in cm -long HCSR04::distance(){ - duration = echo_duration(); - distance_cm = (duration/2)/29.1 ; - return distance_cm; +int HCSR04::uzaklik(){ + sure = echo_sure(); + mesafe_cm = (sure/2)/29.1 ; + return mesafe_cm; } \ No newline at end of file