4-Axisと同じラインセンサのライブラリ

Dependents:   00_yotsuba 10_motor-test 00_yotsuba 200_yotsuba_21

Files at this revision

API Documentation at this revision

Comitter:
THtakahiro702286
Date:
Sat Mar 06 07:25:53 2021 +0000
Parent:
1:2d25db124969
Commit message:
digitalIn

Changed in this revision

line.cpp Show annotated file Show diff for this revision Revisions of this file
line.h Show annotated file Show diff for this revision Revisions of this file
diff -r 2d25db124969 -r fb0d0bb8fc5b line.cpp
--- a/line.cpp	Thu Mar 04 11:57:42 2021 +0000
+++ b/line.cpp	Sat Mar 06 07:25:53 2021 +0000
@@ -20,10 +20,11 @@
 void Line::lineassemble()
 {
     while(true) {
-        linevalue = 3300 * linesensor.read();
-        if(linevalue > lineborder) judgvalue = true;
-        else judgvalue = false;
-        thread_sleep_for(1000);
+//        linevalue = 3300 * linesensor.read();
+//        if(/*linevalue > lineborder*/linesensor) judgvalue = true;
+//        else judgvalue = false;
+        judgvalue = linesensor;
+        thread_sleep_for(1);
     }
 }
 
diff -r 2d25db124969 -r fb0d0bb8fc5b line.h
--- a/line.h	Thu Mar 04 11:57:42 2021 +0000
+++ b/line.h	Sat Mar 06 07:25:53 2021 +0000
@@ -38,7 +38,8 @@
     operator bool();
 
 private:
-    AnalogIn linesensor;
+//    AnalogIn linesensor;
+    DigitalIn linesensor;
     float linevalue, lineborder;
     Thread thread;
     void lineassemble();