一墙一别院 发表于 2013-12-5 19:37 
你这个好像也没协议的,精简了一个已经修复了mega8的定时器错误,你自己试下行不行
先谢谢哥们,其次,编译好像过不了,报错了
代码:- #include <IRremote.h>
- #include <IRremoteInt.h>
- int RECV_PIN = 11;//定义红外接收器的引脚为11
- IRrecv irrecv(RECV_PIN);
- decode_results results;
-
- void setup()
- {
- Serial.begin(9600);
- irrecv.enableIRIn(); // 初始化红外接收器
- }
-
- void loop() {
- if (irrecv.decode(&results)) {
- Serial.println(results.value, HEX);//以16进制换行输出接收代码
- Serial.println();//为了便于观看输出结果增加一个空行
- irrecv.resume(); // 接收下一个值
- }
- }
复制代码 用Atm8 和 uno 都 报错,编译不过
IRremoteMin\IRremote.cpp.o: In function `MATCH(int, int)':
/IRremoteInt.h:176: multiple definition of `MATCH(int, int)'
sketch_dec05a.cpp.o :\Arduino\libraries\IRremoteMin/IRremoteInt.h:176: first defined here
IRremoteMin\IRremote.cpp.o: In function `MATCH_MARK(int, int)':
/IRremoteInt.h:177: multiple definition of `MATCH_MARK(int, int)'
sketch_dec05a.cpp.o :\Arduino\libraries\IRremoteMin/IRremoteInt.h:177: first defined here
IRremoteMin\IRremote.cpp.o: In function `MATCH_SPACE(int, int)':
/IRremoteInt.h:178: multiple definition of `MATCH_SPACE(int, int)'
sketch_dec05a.cpp.o :\Arduino\libraries\IRremoteMin/IRremoteInt.h:178: first defined here |