IRremote da problemas con tone y con Servo.h ¿ solución ?

Hola.
Estoy haciendo un nuevo proyecto y es la primera vez que uso la librería IRremote.h

Pero da errores al compliar si uso tone para enviar tonos a un buzzer.
Lo he quitado y sigue dando errores con la librería de Servo.

libraries/IRremote/IRremote.cpp.o (symbol from plugin): In function `MATCH(int, int)':
(.text+0x0): multiple definition of `__vector_11'
libraries/Servo/avr/Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta Arduino Nano.

¿ Alguien sabe cómo se puede solucionar ?

El error se debe a que todos usan el mismo TIMER 2 y no es posible.

En esta librería Arduino-IRremote se lee la razón

The default IR timer on AVR's is timer 2. Since the Arduino Tone library as well as analogWrite() for pin 3 and pin 11 requires timer 2, this functionality cannot be used simultaneously.

Como IR timer usa el 2, entonces TONE o cualquier cosa que use los pines asociados tendrá poblemas.

Veamos como se cambia.

#define IR_USE_TIMER1 //if not defined, use the default timer as before
#include <IRremote.h> //definitely implements the classes, here for timer 3
IRsend irsend();
IRrecv irrecv();

Prueba de este modo a ver si resulta!

Gracias por la respuesta.

Sigue igual aunque ha camiado algo el mensaje:

libraries/Servo/avr/Servo.cpp.o (symbol from plugin): In function `ServoCount':
(.text+0x0): multiple definition of `__vector_11'
libraries/IRremote/IRremote.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compilando para la tarjeta Arduino Nano.

Coloca por favor, todo el código a ver que solución le damos.

Para tone puedes usar esta librería SoftTonePlayer

Para IRremote modifica en IRremote.h que timer va a usar la librería.

#define IR_USE_TIMER1   // tx = pin 9
// #define IR_USE_TIMER2     // tx = pin 3

cambia por

// #define IR_USE_TIMER1   // tx = pin 9
#define IR_USE_TIMER2     // tx = pin 3

tienes 2 o 3 problemas. Debes evitar que tengan conflictos entre si.

No ha funcionado lo que me sugirió. Le pego la primera parte del código. El resto no tiene mucho interés, son solo pruebas.

#define IR_USE_TIMER1

#include <Servo.h>
#include <IRremote.h> 

const int RECV_PIN = 6;       // pin receptor mando

const int LEDPin = 13;        // pin para el LED
const int BuzzPin = 9;        // pin del buzzer
const int ServoPin = 7;       // pin del servo
const int PIRPin = 2;         // pin de entrada (for PIR sensor)

const int incServo = 2;       // incremento en loop del servo
const int repeServo = 1;      // Veces que se repite el movimiento el servo
 
int pirState = LOW;           // de inicio no hay movimiento
int val = 0;                  // estado del pin

IRsend irsend();
//IRrecv irrecv();

IRrecv irrecv(RECV_PIN);

decode_results results;

Servo servoMotor;

A mi esta prueba no me genera errores.

#define IR_USE_TIMER1

#include <Servo.h>
#include <IRremote.h>

const int RECV_PIN = 6;       // pin receptor mando

const int LEDPin = 13;        // pin para el LED
const int BuzzPin = 9;        // pin del buzzer
const int ServoPin = 7;       // pin del servo
const int PIRPin = 2;         // pin de entrada (for PIR sensor)

const int incServo = 2;       // incremento en loop del servo
const int repeServo = 1;      // Veces que se repite el movimiento el servo
 
int pirState = LOW;           // de inicio no hay movimiento
int val = 0;                  // estado del pin

IRsend irsend();
//IRrecv irrecv();

IRrecv irrecv(RECV_PIN);

decode_results results;

Servo servoMotor;

void setup() {}
void loop() {}
Building in release mode
Compiling .pio\build\nanoatmega328\src\main.cpp.o
Linking .pio\build\nanoatmega328\firmware.elf
Building .pio\build\nanoatmega328\firmware.hex
Checking size .pio\build\nanoatmega328\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  12.7% (used 260 bytes from 2048 bytes)
Flash: [=         ]   5.4% (used 1648 bytes from 30720 bytes)
================================================ [SUCCESS] Took 15.88 seconds ================================================