IRRemote library conflicts with tone() function

Hi Jamsel, I just solved the problem too.

You need to go on your Arduino folder --> Libraries --> IR folder
then you need to find the IRremoteInt.h file. You can open with wordpad.
Try to find the part that says

"
// 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.

..."

You need to find the line that has your Arduino type, mine is the UNO so I used this one:

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

Now you put the "//" in the second line and remove them from the first line. Will look like that:

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

Save the changes and your program should work great.

1 Like