RBG strip arduino

Hi, I need help with an error that I really can’t understand. I wanted to program an RGB led in fade mode. So I looked for the code to replicate the effect, I tried it directly with the led connected to Arduino and it worked, all the colors alternated smoothly as the fade effect should be. So I decided to have the effect activated with an IR remote control. But even just adding " irrecv.enableIRIn (); " in the setup, the effect no longer worked, or rather it worked halfway, to be exact, the red color was not completely turned on by skipping all the shades. Just remove that line of code irrecv.enableIRIn (); and the effect worked again, I can’t understand. Thanks in advance. This is the code:

#include "IRremote.h"

IRrecv irrecv(receiver); 
decode_results results;

int redPin = 3;
int greenPin = 5;
int bluePin = 10;

void setup(){
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);

void loop(){
  for(int i = 0; i < 256; i++){
    rgb(255-i, i, 0);
  for(int i = 0; i < 256; i++){
    rgb(0, 255-i, i);
  for(int i = 0; i < 256; i++){
    rgb(i, 0, 255-i);

void rgb(int red, int green, int blue){
  analogWrite(redPin, red);
  analogWrite(greenPin, green);
  analogWrite(bluePin, blue);

(code tags added by Moderator - next time use the </> button on the menu please.)

Try moving the pin for the red led to pin 6

Yes, I thought about it, then I’ll try. At the moment I can’t because the circuit is soldered, as soon as I have time I’ll try to change the pin

3,5,6,9,10,11 are all acceptable analogWrite() pins.
What will moving red to 6 do?

Of the top of my head IRremote.h uses timer2 which is also used for PWM on pins 3 & 11 (which is therefore disabled on those pins). Hence the suggestion.

Thanks It works