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:
- 8:5b66f431c487
- Child:
- 9:fd45093bcf20
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Dec 01 08:50:27 2020 +0000
@@ -0,0 +1,18 @@
+#include "mbed.h"
+#include "hcsr04.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+HCSR04 usensor(D2,D3);
+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);
+
+ }
+}
\ No newline at end of file