Malfunction of pins 8 , 7 and 11 with libraries <Arduino.h> and <NECIRrcv.h>

I have a program to control 2 motors wich works perfectlly, but when I include this two libraries one motor( wich is conected to pins 8,7 to control the rotation direction and to pin 11pwm to control the speed), doesn´t work. I think the problem is in one of the two libraries wich disables one of the pins. What can I do? I can't change pin assignments because I'm using module L298N H-driver wich have the conections motors-pins predefined.

Thanks a lot
Here is the program:

//En esta parte configuramos las patillas del procesador de arduino UNO para el correcto funcionamiento de los
//motores de c.c.

#include <Arduino.h>
#include <NECIRrcv.h>
#define IRPIN 4 // pin al que conectamos el receptor de IR
static int aux = 1;
NECIRrcv ir(IRPIN) ;

int pwm_motor1=10; //asignamos la variable pwm_motor1 a la patilla 10 del procesador de arduino (enable)
int pwm_motor2=11; //asignamos la variable pwm_motor2 a la patilla 11 del procesador de arduino (enable)
int giroM2_1=2; //asignamos la variable de giroM1_1 a la patilla 2 del procesador de arduino (input)
int giroM2_2=12; //asignamos la variable de giroM1_2 a la patilla 12 del procesador de arduino (input)
int giroM1_1=8; //asignamos la variable de giroM2_1 a la patilla 8 del procesador de arduino (input)
int giroM1_2=7; //asignamos la variable de giroM2_2 a la patilla 7 del procesador de arduino (input)
void setup()
{
///////

////
pinMode(pwm_motor1,OUTPUT); //configuramos la patilla 10 como salida
pinMode(pwm_motor2,OUTPUT); //configuramos la patilla 11 como salida
pinMode(giroM1_1,OUTPUT); //configuramos la patilla 2 como salida
pinMode(giroM1_2,OUTPUT); //configuramos la patilla 12 como salida
pinMode(giroM2_1,OUTPUT); //configuramos la patilla 8 como salida
pinMode(giroM2_2,OUTPUT); //configuramos la patilla 7 como salida
ir.begin() ;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//esta parte del programa hace que el ardutrón avance hacia adelante
void loop()
{

///
unsigned long ircode ;
while (ir.available()) {
ircode = ir.read() ;

digitalWrite(giroM1_1,LOW); //metemos un "0" lógico a la patilla 2 del procesador
digitalWrite(giroM1_2,HIGH); //metemos un "1" lógico a la patilla 12 del procesador
digitalWrite(giroM2_1,LOW); //metemos un "1" lógico a la patilla 8 del procesador
digitalWrite(giroM2_2,HIGH); //metemos un "0" lógico a la patilla 7 del procesador
analogWrite (pwm_motor1,50);//metemos una señal PWM de 250 al enable (patilla 10)
analogWrite (pwm_motor2,50);//metemos una señal PWM de 250 al enable (patilla 10)

}
}

juanillo1205:
I have a program to control 2 motors wich works perfectlly, but when I include this two libraries one motor( wich is conected to pins 8,7 to control the rotation direction and to pin 11pwm to control the speed), doesn´t work. I think the problem is in one of the two libraries wich disables one of the pins. What can I do? I can't change pin assignments because I'm using module L298N H-driver wich have the conections motors-pins predefined.

Hi.

Can you tell us what exactly doesn't work ?

Your IR (NEC protocol) library seems to be busy with some timers.
If it changes an internal timer, then some PWM pins will not work any more like it's supposed to do, as PWM depends on timers.
You would need to check if that library does that, and if you can't change pins because you need to use that shield, then you can't use this library.

You can consider to build a "shield" which will mix up some pins so you can use both the motorshield and the library.
For this to work you would need to make it so that there will be a small mechanical offset between the Arduino and the motorshield.

That library uses timer2 which means that PWM on pins 11 and 3 is no longer available.