請問如何解決 IRremote 與 tone 衝突
我在這裡下載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, 所以才會衝突, 請問該如何解決。
源碼如下:
#include <IRremote.h>
void setup()
{
tone(11, 1140, 200);
}
void loop()
{
} 在tone后面要跟一个和tone一样长时间的delay,因为执行了tone以后会继续执行后面的代码,加个delay让tone完事了再继续。应该就不会冲突了。 本帖最后由 pizg 于 2014-3-9 16:51 编辑
shihaipeng04 发表于 2014-3-9 15:37 static/image/common/back.gif
在tone后面要跟一个和tone一样长时间的delay,因为执行了tone以后会继续执行后面的代码,加个delay让tone完 ...
你說的方法還是不行! :(
#include <IRremote.h>
void setup()
{
tone(11, 1140, 200);
delay(200);
}
void loop()
{
}
页:
[1]