Hi everyone! I'm a beginner to Arduino world and I love it but sometimes (quite often) i get a blocked with certain projects, like the one Im trying to do now.
I have an Arduino Mega, and for my IR remote project I'm using the IR library by Ken Shirriff.
So far so good, the problem comes when I try to add an extra function (melody for example).
#include <IRremote.h>
int RECV_PIN = 11;
int buzz = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
//melody(); // WHEN I ADD AN EXTRA FUNCTION LIKE THIS ONE I GET AN ERROR
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
/*void melody(){
tone(buzz, 2500, 150);
delay(150);
tone(buzz, 2500, 150);
delay(150);
tone(buzz, 2500, 150);
delay(150);
tone(buzz, 4186, 500);
}*/
//ERRROR WHEN I TRY TO ADD AN EXTRA FUNCTION LIKE THIS ONE
And that's when i get this error:
Arduino:1.6.6 (Windows 7), Placa:"Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Admin\AppData\Local\Temp\buildaf6b3c979e963c25610b5838ddac79d0.tmp/core\core.a(Tone.cpp.o): In function `__vector_13':
C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Tone.cpp:539: multiple definition of `__vector_13'
libraries\IRremote\IRremote.cpp.o:C:\Program Files (x86)\Arduino\libraries\IRremote/IRremote.cpp:124: first defined here
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
collect2.exe: error: ld returned 1 exit status
exit status 1
Error de compilación
Este informe podría tener más información con
"Mostrar salida detallada durante la compilación"
activala desde Archivo > Preferencias
Any ideas why this is happening?
Thanks in advance guys!
I would appreciate any help/comments.
Looks like a good library for the NEC remotes. Especially useful for people using Arduinos based on the '328P or similar, since they don't have the extra timers to implement my suggestion. Nice work Larry.
Unfortunately still not working I've change the timer in that file and no sucess.
This is what I changed in the IRremoteInt.h file. See below:
// Define which timer to use
//
// Uncomment the timer you wish to use on your board.
// If you are using another library which uses timer2, you have options to
// switch IRremote to use a different timer.
//