Help with RGB LED Light code

HI, I hate having to ask for help, but I have been trying this for two days and I can’t get it to work. :~ I have made a RGB lamp with a arduino in it controlling a 3W RGB LED, it also has a Infared receiver.

I have a small remote, and have programmed it with three buttons, Off, Turns all Led’s LOW. WHITE, turns on the White light, my RGB led also has a white led. And ramdom, which fades through all the colors. I found the fade code elsewhere on the internet and have tried to integrate it into my own.

MY PROBLEM
White light works, off works when on white mode, I haven’t integrated turning off from the fade routine yet because I can’t get fade to work. The stock fade code works great, but when I put it into my own project it ONLY randomly fades the GREEN and BLUE lights up and down, the RED doesn’t come on. BUT as I said the stock code works great, and all I did was copy and paste it! I tried going through it line by line, and can’t figure it out.

The fade code as pulled from the internet works as advertised

if (value1 > current_value1){
  
  current_value1++;
  analogWrite(pin1, current_value1);
  delay(x);
}
  
if (value1 < current_value1){
 
 current_value1--;
analogWrite(pin1, current_value1);
delay(x);
  
}

if (value1 == current_value1){
 
 analogWrite(pin1, current_value1);
 value1 = random(BRIGHTNESS); 
  
}
  
  
  
  //////////////////////////
  
  if (value2 > current_value2){
  
  current_value2++;
  analogWrite(pin2, current_value2);
  delay(x);
}
  
if (value2 < current_value2){
 
 current_value2--;
analogWrite(pin2, current_value2);
delay(x);
  
}

if (value2 == current_value2){
 
 analogWrite(pin2, current_value2);
 value2 = random(BRIGHTNESS); 
  
}




///////////////////////////////



if (value3 > current_value3){
  
  current_value3++;
  analogWrite(pin3, current_value3);
  delay(x);
}
  
if (value3 < current_value3){
 
 current_value3--;
analogWrite(pin3, current_value3);
delay(x);
  
}

if (value3 == current_value3){
 
 analogWrite(pin3, current_value3);
 value3 = random(BRIGHTNESS ); 
  
}
}

MY CODE PAGE ONE
pin1=red
pin2=green
pin3=blue
pin4=white

#include <IRremote.h>

int pin1 = 11;
int pin2 = 10;
int pin3 = 9;
int pin4 = 6;
int RECV_PIN = 3;
int MAX_BRIGHT = 5;
int x=10;         //delay time


long value3;
long value2;
long value1;

long current_value3;
long current_value2;
long current_value1;

//----------------------------------------------------------------
#define OFF               0xFF00C03F
#define pin4_LIGHT       0xFF0040BF
#define RANDOM            0xFF00708F
#define PAUSE             0xFF00E01F
                                          // Remote Codes

//----------------------------------------------------------------
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{  
  
 

irrecv.enableIRIn();

pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT);
}

void loop()  //--------------------------------------------------------
{
  if (irrecv.decode(&results)) {
    if ( results.value != 0xFFFFFFFF) {
      switch (results.value) {
      case OFF :
        
        digitalWrite (pin1, LOW);
        digitalWrite (pin2, LOW);
        digitalWrite (pin3, LOW);
        digitalWrite (pin4, LOW);
        break;
      case pin4_LIGHT :
        
        analogWrite (pin4, MAX_BRIGHT);    
        break;
      case RANDOM :
       fadecode();
       break;
      }
    }
   irrecv.resume();
  }
}

SECOND TAB

void fadecode(){ 
randomSeed(analogRead(0)); 

value1 = random(MAX_BRIGHT);
current_value1 = value1;
value2 = random(MAX_BRIGHT);
current_value2 = value2;
value3 = random(MAX_BRIGHT);
current_value3 = value3;

analogWrite(pin1, current_value1);
analogWrite(pin2, current_value2);
analogWrite(pin3, current_value3);

value1 = random(MAX_BRIGHT);
value2 = random(MAX_BRIGHT);
value3 = random(MAX_BRIGHT);

while(1){
if (value1 > current_value1){
  
  current_value1++;
  analogWrite(pin1, current_value1);
  delay(x);
}
  
if (value1 < current_value1){
 
 current_value1--;
analogWrite(pin1, current_value1);
delay(x);
  
}

if (value1 == current_value1){
 
 analogWrite(pin1, current_value1);
 value1 = random(MAX_BRIGHT); 
  
}
  
  
  
  //////////////////////////
  
  if (value2 > current_value2){
  
  current_value2++;
  analogWrite(pin2, current_value2);
  delay(x);
}
  
if (value2 < current_value2){
 
 current_value2--;
analogWrite(pin2, current_value2);
delay(x);
  
}

if (value2 == current_value2){
 
 analogWrite(pin2, current_value2);
 value2 = random(MAX_BRIGHT); 
  
}




///////////////////////////////



if (value3 > current_value3){
  
  current_value3++;
  analogWrite(pin3, current_value3);
  delay(x);
}
  
if (value3 < current_value3){
 
 current_value3--;
analogWrite(pin3, current_value3);
delay(x);
  
}

if (value3 == current_value3){
 
 analogWrite(pin3, current_value3);
 value3 = random(MAX_BRIGHT ); 
  
}
} 
}

If anyone knows why this strange behavior is happening I would be very grateful, I just want to finish this led project. It is a quite simple project compared to my ARDUINO ultrasonic rover, and is strange that I can’t figure it out, I also have built the light as a piece of furniture, so I just want it finished, this isn’t something I was planning on messing with for a month.

Schematic?
Without one we can only guess what you code is trying to do.

Pin1 = RED
Pin2 = GREEN
Pin3 = BLUE
Pin4 = WHITE
RECV_PIN is part of the infared library, I am using the Ken Sherrif one.
MAX_BRIGHT is what I am using as the analogWrite maximum value, I have it set to 5 in the code I showed you so the thing won't blind me with the lamp shade off.
x=10 is from the fade code, it is the delay for fading.

The led pins are connected to the bases of power transistors that when HIGH, or PWM, activate their respective LED color. The transistors are good for something like 6 AMPS each. And the infared receiver is connected to +5v, ground, and arduino pin 3. As far as circuitry that is all there is.

In what way is that a schematic.

It is just words telling me how some things are wired up. It misses out a lot.

I will, but I'm at work, I will make one when I get home.