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

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers line.h Source File

line.h

00001 #ifndef LINE_H
00002 #define LINE_H
00003 
00004 #include "mbed.h"
00005 
00006 #define DEFAULT_LINESENSOR_JUDGVALUE 400
00007 
00008 /**
00009  * ラインセンサ用クラス
00010  */
00011 class Line{
00012 public:
00013     /**
00014      * デフォルトコンストラクタ
00015      */
00016     Line(PinName line_);
00017     
00018     Line(PinName line_, float border_);
00019     
00020     /**
00021     *ラインとの境目の位置
00022     */
00023      void border(float border_);
00024      
00025      
00026     /**
00027     *ラインの判別表示
00028     *1だとライン踏んでいる
00029     *0だとラインを踏んでいない
00030     */
00031     bool judg();
00032     
00033     /**
00034     *センサの値表示
00035     */
00036     float value();
00037     
00038     operator bool();
00039 
00040 private:
00041 //    AnalogIn linesensor;
00042     DigitalIn linesensor;
00043     float linevalue, lineborder;
00044     Thread thread;
00045     void lineassemble();
00046     bool judgvalue;
00047 
00048 };
00049 
00050 
00051 
00052 #endif