Hi,
I'm trying to activate or disactivate a press button that activates the buzzer with a remote control and I get the following error:
Arduino:1.8.4 (Windows 10), Tarjeta:"Arduino/Genuino Uno"
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.
My code:
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <IRremote.h>
int receptor = 9;
int led = 6;
int alarmaon;
const int buttonPin = 7;
int buttonState = 0;
const int speakerPin = 8;
IRrecv irrecv(receptor);
decode_results codigo; //OBJETO CODIGO DE CLASE decode_result, oriundo de IRremote.h
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // INICIA LA RECEPCIÓN
pinMode(led, OUTPUT);
pinMode(speakerPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop()
{
if (irrecv.decode(&codigo))
{
Serial.println(codigo.value, HEX);
if (codigo.value == 0xFF42BD) //CÓDIGO DEL NÚMERO 7
{
digitalWrite(led, HIGH);
alarmaon = true;
}
if (codigo.value == 0xFF4AB5) //CÓDIGO DEL NÚMERO 8
{
digitalWrite(led, LOW);
alarmaon = false;
}
irrecv.resume();
}
if (alarmaon = true) {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
noTone(speakerPin);
delay(200);
tone(speakerPin, 440, 200);
delay(200);
}
else {
noTone(speakerPin);
}
}
}
Thank you very much!