IR Remote command disables one side of a Motor Controller

Hello,

I am experiencing a strange issue when I use the IR Remote library in the same code as a motor controller. The command to enable the IR receiver (irrecv.enableIRIn();) inexplicably prevents the left relay from working at all. I have tried moving all inputs to different pins, using different Arduino boards, and removing components, but the irrecv.enableIRIn(); command always disables the left relay on the motor controller. Will you please help me solve this issue?

The IR Remote library I am using is included. The code below is simply a test of the relay's functions. When the command irrecv.enableIRIn(); is commented out, both relays work. When it is active, the left relay does not work at all.

IRremote.zip (33.8 KB)

// Motors: 2x motors are used to drive the wheels and move the car.
#define enL 11 // Define the ports for each pin of the motor drive module.  (enL = enA on the module.)
#define inL1 10 // in1
#define inL2 9 // in2
#define enR 6 // enB
#define inR1 8 // in3
#define inR2 7 // in4
int randfreeroam; // Randomly generated variable that determines the response to an obstacle.

// IR Remote: Unit can receive signals from an IR remote to control movement.
//www.elegoo.com
//2016.12.9
#include "IRremote.h"
int receiver = A0; // Signal Pin of IR receiver to Arduino Analog Pin 0
//-----( Declare objects )-----
IRrecv irrecv(receiver);     // create instance of 'irrecv'
decode_results results;      // create instance of 'decode_results'

void setup() { // Setup all inputs and outputs
  Serial.begin(9600); // Enables Arduino IDE to read Serial messages from the Arduino
  pinMode(enL, OUTPUT); // Set all motor functions as outputs
  pinMode(enR, OUTPUT);
  pinMode(inL1, OUTPUT);
  pinMode(inL2, OUTPUT);
  pinMode(inR1, OUTPUT);
  pinMode(inR2, OUTPUT);
  irrecv.enableIRIn(); // Start the IR receiver. <-- THIS COMMAND CAUSES THE PROBLEM 
  delay(1000); // Delay before beginnning
}

void loop() { // Main program
  forward();
  Serial.println("forward");
  delay(1000);
  left();
  Serial.println("left");
  delay(1000);
  right();
  Serial.println("right");
  delay(1000);
  back();
  Serial.println("back");
  delay(1000);
  stop();
  Serial.println("stop");
  delay(1000);
}

void right() { // Spin the left wheel forward and the right wheel back.
  Serial.println("right");
  analogWrite(enL, 175);
  analogWrite(enR, 175);
  digitalWrite(inL1, LOW);
  digitalWrite(inL2, HIGH);
  digitalWrite(inR1, HIGH);
  digitalWrite(inR2, LOW);
}

void forward() { // Spin both wheels forward.
  Serial.println("forward");
  analogWrite(enL, 175);
  analogWrite(enR, 175);
  digitalWrite(inL1, LOW);
  digitalWrite(inL2, HIGH);
  digitalWrite(inR1, LOW);
  digitalWrite(inR2, HIGH);
}

void left() { // Spin the right wheel forward and the left wheel back.
  Serial.println("left");
  analogWrite(enL, 175);
  analogWrite(enR, 175);
  digitalWrite(inL1, HIGH);
  digitalWrite(inL2, LOW);
  digitalWrite(inR1, LOW);
  digitalWrite(inR2, HIGH);
}

void back() { // Spin both wheels backward.
  Serial.println("back");
  analogWrite(enL, 175);
  analogWrite(enR, 175);
  digitalWrite(inL1, HIGH);
  digitalWrite(inL2, LOW);
  digitalWrite(inR1, HIGH);
  digitalWrite(inR2, LOW);
}

void stop() { // Stop both wheels.
  Serial.println("stop");
  digitalWrite(enL, LOW);
  digitalWrite(enR, LOW);
}

You did not include sufficient detail for a meaningful answer, so all you get are questions.

What board?

What IRremote library? What version?

Can A0 be used for an output with your IRremote library on your board?

Have you looked at which timers might be used by both your IRremote library and analogWrite on your chosen pins?

Elegoo Arduino Uno R3

Here is the link given by the library I provided:

My version of the library was included with the 2021 Elegoo Arduino Uno Super Starter Kit, so it's intended to be compatible with Arduino Uno. The only information about the version is "2016.12.9." It seems they have updated the library several times since then, and I can't find a version history on the provided website. The current version doesn't mention Arduino Uno, so I don't believe it's compatible.

You've answered half the questions.

This is all the information I have:

The current version on the website doesn't mention Arduino Uno pinouts, so I don't believe it's compatible. I can't find documentation for library pinouts for the old version I'm using.

Arduino Uno timers are not mentioned on the website either.

Why you write about relays when your code tells you have motor controller?
I don't know about your "special" library version (and I suggest you to switch to latest IRremote), but generally pins 3 and 11 (timer2) are occupied (for pwm) by IRremote library.
And your motor driver uses 11.
Swap that to some other pwm pin (10 for example).

I literally googled the answer in under 10 seconds. If you're not going to put any effort into solving your problem, you're doomed.

I used the wrong terminology, thank you for clarifying. I am using a motor controller. I will change this in the title to clarify for others.

Thank you for the suggestion; I will try this out and let you know if it works.

It will... For pins 5,6,9 or10

It worked, thank you very much! Here's my new pinout for the motor driver:

// Motors: 2x motors are used to drive the wheels and move the car.
#define enL 10 // Define the ports for each pin of the motor drive module.  enL = enA on the module.
#define inL1 9 // in1
#define inL2 8 // in2
#define enR 5 // enB
#define inR1 7 // in3
#define inR2 6 // in4