I looked up how to control an arduino with an IR remote and I found this library:
It works, but when I use this library and the tone() function in the same sketch I get an error.
Here is my code:
#include <IRremote.h>
[const int sound = 8;
const int led = 2;
const int sensor = 3;
int RECV_PIN = 10;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
pinMode(led, OUTPUT);
pinMode(sensor, INPUT);
pinMode(sound, OUTPUT);
irrecv.enableIRIn(); // Start the receiver
}
void loop(){
while(digitalRead(sensor) == LOW);
while(true){
delay(500);
tone(sound, 262);
digitalWrite(led, HIGH);
delay(500);
//noTone(snd);
digitalWrite(led, LOW);
}
}
[
And here is my error:
core.a(Tone.cpp.o): In function `__vector_7':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Tone.cpp:535: multiple definition of `__vector_7'
IRremote\IRremote.cpp.o:C:\Users\Albert\Documents\Arduino\libraries\IRremote/IRremote.cpp:337: first defined here
When I comment out either the IR library calls or the tone() and noTone() functions, the code compiles fine.
I suspect that the tone() function and the IR libraries are conflicting, but I'm not sure. Any thoughts?