Norawit Nangsue
/
hcsr04
hcsr04
Revision 0:2d72adb60ef0, committed 2014-07-02
- Comitter:
- oakx
- Date:
- Wed Jul 02 17:40:12 2014 +0000
- Commit message:
- oak;
Changed in this revision
diff -r 000000000000 -r 2d72adb60ef0 HCSR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Wed Jul 02 17:40:12 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/prabhuvd/code/HCSR04/#71da0dbf4400
diff -r 000000000000 -r 2d72adb60ef0 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 02 17:40:12 2014 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "hcsr04.h" + +HCSR04 usensor(p26,p16);//trig pin,echo pin +Serial pc(USBTX, USBRX); +unsigned int dist; +int main() +{ + + while(1) { + usensor.start(); + wait_ms(500); + dist=usensor.get_dist_cm(); + pc.printf("Distance = %d cm\n",dist); + + } +} \ No newline at end of file
diff -r 000000000000 -r 2d72adb60ef0 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jul 02 17:40:12 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file