ロボカップジュニアサッカー IRM2121を用いた専用パルスボールを検知するためのライブラリ
Dependents: BallCheck_IRM2121_InterrputInAdd CatPot_SensorRight
Pingのライブラリを参考にしました。 RoboCupJuniorSoccerにおけるボール検知をまとめて行うために作成したライブラリ。
距離に応じて微妙に値が変わるようになりました。 まともに使えます。
なお、このライブラリには、interruptinの機能を拡張するためのライブラリが含まれています。 そのため、必要なときだけピン変化割り込みに入ることが可能となっています。
値に応じて関数ポインタとかすれば距離によって値かわるようにできるかも if文で十分かもしれません
Diff: IRM2121.h
- Revision:
- 1:b25c8ac20d5b
- Parent:
- 0:fd5c1ea78a7c
- Child:
- 2:40101fcb6d44
diff -r fd5c1ea78a7c -r b25c8ac20d5b IRM2121.h --- a/IRM2121.h Sun Nov 09 11:11:37 2014 +0000 +++ b/IRM2121.h Fri Dec 05 14:51:05 2014 +0000 @@ -4,6 +4,7 @@ #define MBED_IRM_H #include "mbed.h" +#include "interruptin_mod.h" /** IRM2121 class, based on an InterruptIn pin, and a timer * use RoboCup Junior Soccer to find PULSE BALL. @@ -13,7 +14,6 @@ * // Set interrupt and read sensor. * #include "mbed.h" * #include "IRM2121.h" - * * IRM2121 IR(p21); * * int main() { @@ -21,7 +21,7 @@ * while(1) { * - * IR.Send(); + * IR.Set(); * wait_ms(10); * range = IR.Read(); * } @@ -50,8 +50,8 @@ protected: - InterruptIn _event; - Timer _timer; + interruptin_mod _event; + Timer _timer; bool _Flag; bool _Valid;