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.
Diff: main.cpp
- Revision:
- 9:fd45093bcf20
- Parent:
- 8:5b66f431c487
- Child:
- 10:1d0fc62de664
--- a/main.cpp Tue Dec 01 08:50:27 2020 +0000
+++ b/main.cpp Wed Dec 02 15:52:45 2020 +0000
@@ -3,16 +3,16 @@
Serial pc(USBTX, USBRX); // tx, rx
-HCSR04 usensor(D2,D3);
+HCSR04 usensor(D7,D8); //(PinName TrigPin,PinName EchoPin):
int main()
{
unsigned int dist;
pc.baud(115200);
while(1) {
usensor.start();
- wait_ms(500);
- dist=usensor.get_dist_cm();
- pc.printf("Distance =%d",dist);
+ dist=usensor.get_dist_cm();
+ pc.printf("Distance =%d\n",dist);
+ wait_ms(2000);
}
}
\ No newline at end of file