I have just started with Arduino and C++ so I apologise if my question is very basic. I am trying to use tone() with a passive buzzer to create a sound while also using the IRremote library for a remote. However, whenever they are used together, it gives this error:
Tone.cpp.o (symbol from plugin): In function `timer0_pin_port':
(.text+0x0): multiple definition of `__vector_7'
libraries\IRremote\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.
This is the code required to recreate this error:
#include "IRremote.h"
#include "pitches.h"
int melody[] = {NOTE_C5, NOTE_E6};
void setup() {}
void loop() {
for (int thisNote = 0; thisNote < 2; thisNote++) {
tone(3, melody[thisNote], 300);
}
}
Please could you advise me on how to fix this issue and if necessary, on a different library or way to create a sound or to receive IR signals?