Smartage application
Dependencies: BufferedSerial SX1276GenericLib USBDeviceHT mbed Crypto X_NUCLEO_IKS01A2
Fork of STM32L0_LoRa by
Revision 31:6bf5a868695f, committed 2018-09-17
- Comitter:
- marcozecchini
- Date:
- Mon Sep 17 20:42:51 2018 +0000
- Parent:
- 30:d43802606136
- Child:
- 32:c22ce5fdacbf
- Commit message:
- Bug fixed 3;
Changed in this revision
hcsr04.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/hcsr04.cpp Mon Sep 17 20:39:50 2018 +0000 +++ b/hcsr04.cpp Mon Sep 17 20:42:51 2018 +0000 @@ -19,4 +19,12 @@ return timer.read_us(); } + +//return distance in cm +long HCSR04::distance(){ + duration = echo_duration(); + distance_cm = (duration/2)/29.1 ; + return distance_cm; + +} \ No newline at end of file