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

Dependencies:   IRsensor

Files at this revision

API Documentation at this revision

Comitter:
skouki
Date:
Mon Jun 24 07:31:08 2019 +0000
Child:
1:0d0124555ec5
Commit message:
IRsensor's sample;

Changed in this revision

IRsensor.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-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/IRsensor.lib	Mon Jun 24 07:31:08 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/skouki/code/IRsensor/#d0a252247fec
--- /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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon Jun 24 07:31:08 2019 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#6f338f8915d22737ecb5f3de508584b6fb00749e