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 Serial pc(USBTX, USBRX); // tx, rx 00005 00006 HCSR04 usensor(D7,D8); //(PinName TrigPin,PinName EchoPin): 00007 int main() 00008 { 00009 unsigned int dist; 00010 pc.baud(115200); 00011 while(1) { 00012 usensor.start(); 00013 dist=usensor.get_dist_cm(); 00014 pc.printf("Distance =%d\n",dist); 00015 wait_ms(500); 00016 00017 } 00018 }
Generated on Wed Jul 13 2022 17:49:39 by
