GP2Y0A21YK0F IRsensor 用ライブラリサンプル

Dependencies:   IRsensor

Revision:
0:d786c8cffc11
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 24 07:31:08 2019 +0000
@@ -0,0 +1,18 @@
+#include"mbed.h"
+#include"IRsensor.h"
+
+IRsensor ir1(PA_1);
+
+Serial pc(USBTX,USBRX);
+Timer t;
+
+int main()
+{
+    while(1){
+        t.reset();
+        t.start();
+        float dis = ir1.getDistance(3);
+        pc.printf("dis:%4.4f[cm]||t:%d[us]\n\r",dis,t.read_us());
+        
+    }   
+}
\ No newline at end of file