The Professional Perfectionists
/
Test_UltraSonic
Basic distance test from ultraSonic sensor
Revision 0:1fa203f27322, committed 2015-03-31
- Comitter:
- joshwilkins2013
- Date:
- Tue Mar 31 22:39:10 2015 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 1fa203f27322 HCSR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Tue Mar 31 22:39:10 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/antoniolinux/code/HCSR04/#86b2086be101
diff -r 000000000000 -r 1fa203f27322 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Mar 31 22:39:10 2015 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" +#include "hcsr04.h" + +Serial pc(USBTX, USBRX); // tx, rx +HCSR04 sensor(A3,A2); // Trigger , Echo +int main(){ + pc.baud(9600); + while(1){ + long distance = sensor.distance(); + pc.printf("distance %d \n",distance); + wait(1.0); // 1 sec + } +} \ No newline at end of file
diff -r 000000000000 -r 1fa203f27322 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Mar 31 22:39:10 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0 \ No newline at end of file