Didier Donsez
/
Nucleo_Ultrasonic-HCSR4
simple test of ultrasonic library for HC-SC04
Diff: main.cpp
- Revision:
- 0:65d91f9edab4
diff -r 000000000000 -r 65d91f9edab4 main.cpp --- /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