Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 3342|回復: 2
打印 上一主題 下一主題

請問如何解決 IRremote 與 tone 衝突

[複製鏈接]
跳轉到指定樓層
1#
發表於 2014-3-9 10:48:14 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
本帖最後由 pizg 於 2014-3-10 00:58 編輯

我在這裡下載Library https://github.com/coopermaa/Arduino-IRremote


上載程式時會出現下列訊息:

core.a(Tone.cpp.o): In function `__vector_7':

D:\arduino-1.0.5\hardware\arduino\cores\arduino/Tone.cpp:535: multiple definition of `__vector_7'

IRremote\IRremote.cpp.o:D:\arduino-1.0.5\libraries\IRremote/IRremote.cpp:311: first defined here


我大概知道是 IRremote 和 tone() 都使用 Timer 2, 所以才會衝突, 請問該如何解決。


代碼如下:


  1. #include <IRremote.h>

  2. void setup()
  3. {
  4. tone(11, 1140, 200);
  5. }

  6. void loop()
  7. {
  8. }
複製代碼

2#
發表於 2014-3-10 00:14:37 | 只看該作者
回復 1# pizg

試試調整:IRremoteInt.h 看看
  1.    #define IR_USE_TIMER1  
  2. //  #define IR_USE_TIMER2   
複製代碼
讓IRRemote改用TIMER1
3#
 樓主| 發表於 2014-3-10 00:57:28 | 只看該作者
回復  pizg

試試調整:IRremoteInt.h 看看讓IRRemote改用TIMER1
babyfish0226 發表於 2014-3-10 00:14

問題解決了, 感謝!
我想做一個麵包發酵箱給老婆,
有用到藍芽, 紅外線, DS18B20溫度傳感器, DHT-11濕度傳感器, 加熱燈, 造霧器, 定時和音效等功能,
Arduino 單一功能還蠻簡單的,
不過真要做一個實用的東西時難度就出現了.
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-9-30 15:32 , Processed in 0.178428 second(s), 8 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表