Match Lab
/
sample_HCSR04
demo program for HCSR04.
Conection
Revision 0:a982b6866f6c, committed 2015-03-29
- Comitter:
- Match314
- Date:
- Sun Mar 29 09:59:44 2015 +0000
- Commit message:
- up
Changed in this revision
diff -r 000000000000 -r a982b6866f6c HCSR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Sun Mar 29 09:59:44 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/prabhuvd/code/HCSR04/#71da0dbf4400
diff -r 000000000000 -r a982b6866f6c main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 29 09:59:44 2015 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" +#include "hcsr04.h" + +HCSR04 sensor(PB_8, PB_9); +Serial pc(USBTX, USBRX); + +int main() { + pc.baud(921600); + + while(1) { + sensor.start(); + wait_ms(100); + pc.printf("%dcm\n", sensor.get_dist_cm()); + } +}
diff -r 000000000000 -r a982b6866f6c mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Mar 29 09:59:44 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file