Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "hcsr04.h" 00003 00004 hcsr04 hcsr04a(p15, p16); 00005 hcsr04 hcsr04b(p15, p17); 00006 00007 Serial pc(USBTX, USBRX); // tx, rx 00008 00009 int main() { 00010 pc.printf("Starting measurement readings."); 00011 while(1) { 00012 hcsr04a.trigger(); // start trigger signal 00013 00014 wait_ms(250); // wait at least 50 ms before triggering. 00015 pc.printf("%f\t%f\t%f\t%f\r\n",hcsr04a.inches(), hcsr04a.cm(), hcsr04b.inches(), hcsr04b.cm()); 00016 } 00017 }
Generated on Fri Jul 22 2022 21:45:20 by
1.7.2