Jon Smith
/
mbed_hcsr04
An example program for hcsr04 output to serial terminal
main.cpp
- Committer:
- jonsmith
- Date:
- 2015-04-28
- Revision:
- 0:ac4184adfe34
File content as of revision 0:ac4184adfe34:
#include "mbed.h" #include "hcsr04.h" DigitalOut myled(LED1); Serial pc(USBTX, USBRX); HCSR04 usensor(p25,p6); unsigned int dist; int main() { while(1) { usensor.start(); wait_ms(500); dist=usensor.get_dist_cm(); pc.printf("cm:%ld\r\n",dist ); } }