Error in Compiling my "IR Remote controlled speaker" script (library issues?)

So I am trying to control an 8 ohm speaker (does have an amplifier) with a cheap little IR remote and receiver. I know all the hex values of the buttons I want using the serial monitor page. I believe that my code should most likely work although I’m sure there’s errors somewhere. I get an error in compiling that I’ll attach a screenshot of because the error code itself is far too long. I believe it’s something about the library im using or its installation. I know that the IRremote.h library (installed directly from arduino libraries) can interfere with the built in library named something like “Robot IR Remote” so i deleted that from the installation location library folders. Github also said to do that (i also tried installing from github in hopes it would change something. I’m at a loss for what to do next and I just want this remote control to work. Any help is much appreciated!

Here is the code:

#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>


// Define hex values for IR Remote buttons 1-9
#define Button_1 0xFF30CF
#define Button_2 0xFF18E7
#define Button_3 0xFF7A5
#define Button_4 0xFF10EF
#define Button_5 0xFF38C7
#define Button_6 0xFF5AA5
#define Button_7 0xFF42BD
#define Button_8 0xFF4AB5
#define Button_9 0xFF52AD

// Define tone Hz values for different buttons
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A5  440
#define NOTE_AS5 466
#define NOTE_B5  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587

int receiver = 13;         // initialize pin 11 as our IR Receiver pin
int speaker  = 11;         // initialize pin 11 as speaker;
uint32_t Previous;         // default/previous value for IR recv if it shows 0xFFFFFFFF
// NOTE: 0xFFFFFFFF appears after the button's HEX value if it's continuously held
IRrecv irrecv(receiver);   // creates new instance of receiver
decode_results results;    


void setup() {
  Serial.begin(9600);  // begin serial data
  irrecv.enableIRIn(); // start the receiver

}

void loop() {
  if (irrecv.decode(&results)) {        // if we receive an IR signal
    if (results.value==0xFFFFFFFF) {    // if button is still being held down
      results.value = Previous;         // default to the initial HEX value of button being held down
    }
    switch(results.value) {
      case Button_1: tone(speaker, NOTE_C4, 500); break;
      case Button_2: tone(speaker, NOTE_D4, 500); break;
      case Button_3: tone(speaker, NOTE_E4, 500); break;
      case Button_4: tone(speaker, NOTE_F4, 500); break;
      case Button_5: tone(speaker, NOTE_G4, 500); break;
      case Button_6: tone(speaker, NOTE_A5, 500); break;
      case Button_7: tone(speaker, NOTE_B5, 500); break;
      case Button_8: tone(speaker, NOTE_C5, 500); break;
      case Button_9: tone(speaker, NOTE_D5, 500); break;
    }
  Serial.println(results.value, HEX);   // display hex results
  irrecv.resume();                      // next value
  }
  Previous=results.value;
}

Perhaps you have two libraries both trying to use interrupt 7, which I think is timer2 related from looking at the datasheet. I don't think you need to include IRremoteInt.h if you already include IRremote.h, BTW.

The clashing files are Tone.cpp and IRremote.cpp.

BTW the reason you cite for posting an image rather than text is bogus.

Please don’t post screenshots of errors. Do you see that button “copy error messages” in your screenshot; use that to copy errors to clipboard; next you can paste the content of the clipboard in your post.

Please read https://forum.arduino.cc/index.php?topic=126251.0, replies #11 and #17 (contains an update for newer versions of the IRremote library).

For more detail on how to approach these errors, read https://forum.arduino.cc/index.php?topic=454873.0, reply #3

Please read https://forum.arduino.cc/index.php?topic=126251.0, replies #11 and #17 (contains an update for newer versions of the IRremote library).

Ok, update: I have read through those posts, thank you they were very useful. In my IRremote-2.2.3 folder, I have found the timer declarations for ATMega 328 in the “boarddefs.h” library file. I believe it was line 194 and I un-commented TIMER1 and re-commented TIMER2 as shown:

#else
// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc
// ATmega48, ATmega88, ATmega168, ATmega328
#define IR_USE_TIMER1   // tx = pin 9
//#define IR_USE_TIMER2     // tx = pin 3

#endif

I included the boarddefs.h library in my arduino code and attempted to compile. But I still receive a similar error with specific error code shown here:

one.cpp.o (symbol from plugin): In function `timer0_pin_port':

(.text+0x0): multiple definition of `__vector_7'

C:\Users\jsask\AppData\Local\Temp\arduino_build_488428\libraries\IRremote-2.2.3\IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

Using library IRremote-2.2.3 at version 2.2.3 in folder: C:\Users\jsask\Documents\Arduino\libraries\IRremote-2.2.3 
exit status 1
Error compiling for board Arduino Uno.

So I think I’m still receiving the same exact error. Maybe it’s not timer 2 that’s the issue? From what I had heard I thought that vector 7 had something to do with an interrupt using timer 2. I feel like we are closer to solving this, and thank you for your help but I don’t know where to go from here.

FINAL UPDATE

Everything is working, the redefinition of timer 2 in boarddefs.h has fixed everything. I realized I had an existing zip file in downloads that also contained the library. Deleted all and made sure only location was in the sketch's destination, edited the boarddefs.h and all is good and functional. Thanks to everybody who worked with me on this and sorry for being a little under-informed on how to use this site

You guys made me real happy:)