![](/media/cache/group/TB_quadri.jpg.50x50_q85.jpg)
Example for utrasonic ranging sensor
Fork of Nucleo_Ultrasonic-HCSR4 by
Revision 0:65d91f9edab4, committed 2015-03-29
- Comitter:
- donsez
- Date:
- Sun Mar 29 09:53:55 2015 +0000
- Commit message:
- test of ultrasonic library for HC-SR04
Changed in this revision
diff -r 000000000000 -r 65d91f9edab4 HCSR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Sun Mar 29 09:53:55 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/antoniolinux/code/HCSR04/#86b2086be101
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
diff -r 000000000000 -r 65d91f9edab4 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 29 09:53:55 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file