超音波センサー

Dependencies:   mbed HCSR

Files at this revision

API Documentation at this revision

Comitter:
tomotsugu
Date:
Mon Jul 13 06:32:47 2020 +0000
Commit message:
distance

Changed in this revision

HCSR.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HCSR.lib	Mon Jul 13 06:32:47 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/BERTL_CHEL_18/code/HCSR/#92d1f0be3af4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jul 13 06:32:47 2020 +0000
@@ -0,0 +1,19 @@
+#include "mbed.h"
+#include "hcsr04.h"
+
+Serial pc(USBTX, USBRX);
+HCSR04  usensor(p13,p14);
+unsigned int dist;
+int main()
+{
+    //unsigned char count=0;
+    while(1) {
+        usensor.start();
+        dist=usensor.get_dist_cm();
+        pc.printf("cm:%ld\r\n",dist );
+ 
+        //count++;
+        //pc.printf("Distance =%d\r\n",count);
+        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jul 13 06:32:47 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file