![](/media/cache/group/TB_quadri.jpg.50x50_q85.jpg)
Example for utrasonic ranging sensor
Fork of Nucleo_Ultrasonic-HCSR4 by
Diff: main.cpp
- Revision:
- 0:65d91f9edab4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 29 09:53:55 2015 +0000 @@ -0,0 +1,15 @@ +/* EXAMPLE */ +#include "mbed.h" +#include "hcsr04.h" + +//D12 TRIGGER D11 ECHO +HCSR04 sensor(D12, D11); +int main() { + while(1) { + + long distance = sensor.distance(); + printf("distance %d \n",distance); + wait(1.0); // 1 sec + + } +} \ No newline at end of file