小白一枚,求各位大神指点,编译有误
#include <IRremote.h>int RECV_PIN = 11;
int ledPin = 10; // LED – digital 10
boolean ledState = LOW; // ledstate用来存储LED的状态
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
pinMode(ledPin,OUTPUT); // 设置LED为输出状态
pinMode(9,OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
//一旦接收到电源键的代码, LED翻转状态,HIGH变LOW,或者LOW变HIGH
if(results.value == 0xFF6897){
ledState = !ledState; //取反
digitalWrite(ledPin,ledState); //改变LED相应状态
tone(9,1000);
}
irrecv.resume();
}
}
想利用红外遥控器指挥蜂鸣器工作,原来的红外接收模块是好使的,但是在加入tone函数之后,编译就通不过,错误信息如下:
C:\temp\build415033132321862447.tmp/core.a(Tone.cpp.o): In function `__vector_7':
D:\arduino-1.6.5-r2\hardware\arduino\avr\cores\arduino/Tone.cpp:538: multiple definition of `__vector_7'
IRremote\IRremote.cpp.o:D:\arduino-1.6.5-r2\libraries\IRremote/IRremote.cpp:312: first defined here
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "IRremote.h"
Used: D:\arduino-1.6.5-r2\libraries\IRremote
Not used: D:\arduino-1.6.5-r2\libraries\RobotIRremote
编译有误
求各位大神指点!!!! 库的原因吧,我看到你用的1.65 我用1.06调试是正常的 hnyzcj 发表于 2017-6-17 20:32
我用1.06调试是正常的
对,我用的1.6.5,好像是tone的库与IRremote的库,某个中断引脚冲突了,这个应该怎么去解决,对于库,我们可以进行修改吗?
页:
[1]