5041浏览
查看: 5041|回复: 5

[求助] 小白一枚,求各位大神指点,编译有误

[复制链接]
#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
编译有误


白先森  见习技师
 楼主|

发表于 2017-6-17 15:05:18

求各位大神指点!!!!
回复

使用道具 举报

hnyzcj  版主

发表于 2017-6-17 20:31:31

回帖奖励 +1 创造力

库的原因吧,我看到你用的1.65
回复

使用道具 举报

hnyzcj  版主

发表于 2017-6-17 20:32:25

我用1.06调试是正常的小白一枚,求各位大神指点,编译有误图1
回复

使用道具 举报

白先森  见习技师
 楼主|

发表于 2017-6-18 14:02:47

hnyzcj 发表于 2017-6-17 20:32
我用1.06调试是正常的

对,我用的1.6.5,好像是tone的库与IRremote的库,某个中断引脚冲突了,这个应该怎么去解决,对于库,我们可以进行修改吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
关于楼主
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail