DigitalIn,Timer を使用した ボール検知用ライブラリ
Dependents: CatPot_SensorRight_F CatPot_SensorRight_T
IRM2121.h
00001 00002 00003 #ifndef MBED_IRM_H 00004 #define MBED_IRM_H 00005 00006 #include "mbed.h" 00007 00008 #define NAKATA 833 //周期833us 00009 #define NOT_F 0 00010 00011 /** IRM2121 class, based on an DigitalIn pin, and a timer 00012 * use RoboCup Junior Soccer to find PULSE BALL. 00013 00014 00015 * Example: 00016 * @code 00017 * // Set Digital and read sensor. 00018 * #include "mbed.h" 00019 * #include "IRM2121.h" 00020 * IRM2121 IR(p21); 00021 * 00022 * int main() { 00023 * int length; 00024 00025 * while(1) { 00026 * 00027 * IR.Set(); 00028 * wait_ms(20); //check _Busy 1 &_Valid 0 ....config just wait time. 00029 * length = IR.Read(); 00030 * } 00031 * } 00032 * @endcode 00033 */ 00034 class IRM2121 { 00035 public: 00036 /** Create a IRM2121 object connected to the specified InterruptIn pin 00037 * 00038 * @param IRM_PIN InterruptIn pin to connect to 00039 */ 00040 IRM2121(PinName IRM_PIN); 00041 00042 unsigned int Read (void); 00043 /** Set a IRM2121 Interrupt Pin 00044 * 00045 * @param none 00046 */ 00047 00048 /** Read the result 00049 * 00050 * @param none 00051 */ 00052 00053 private: 00054 00055 DigitalIn _pin; 00056 Timer _timer; 00057 00058 unsigned int _Time; 00059 00060 }; 00061 00062 #endif
Generated on Mon Jul 18 2022 04:43:19 by 1.7.2