HEPTA-Sat Training 2020
/
Lab7-sample_ultrasonic-sensor
for textbook v4.4
HC-SR04 program
Revision 0:5f87b3c8e32a, committed 2019-11-06
- Comitter:
- HeptaSatTraining2019
- Date:
- Wed Nov 06 18:12:17 2019 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 5f87b3c8e32a HCSR04.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HCSR04.lib Wed Nov 06 18:12:17 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/prabhuvd/code/HCSR04/#71da0dbf4400
diff -r 000000000000 -r 5f87b3c8e32a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Nov 06 18:12:17 2019 +0000 @@ -0,0 +1,14 @@ +#include "mbed.h" +#include "hcsr04.h" +Serial pc(USBTX, USBRX); +HCSR04 usensor(p21,p12); +int dist; +int main() +{ + while(1) { + usensor.start(); + dist=usensor.get_dist_cm(); + pc.printf("distance = %d [cm]\r\n",dist); + wait(1); + } +} \ No newline at end of file
diff -r 000000000000 -r 5f87b3c8e32a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Nov 06 18:12:17 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file