4 Pin RGB LED Flickering Flame effect, help!

Hey guys this is my first post on here (go easy), I'm trying to make a flickering LED effect using a 4pin LED, I know normal LED flame tutorials have been done to death but I can't seem to find one for 4pins, I'm using these ones because in my experience theyre a lot brighter. So! Out of curiosity I tried this code with the LED, it works in terms of flickering, but it goes all different colours as opposed to going traditional red/yellow. I've got another 2 of these LED's if its a case of setting them individually to a colour then getting them to flicker. Can anyone point me in the right direction? Any help is appreciated! Thanks

int ledPin1 = 10;
int ledPin2 = 9;
int ledPin3 = 11;

void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
}

void loop() {
analogWrite(ledPin1, random(120)+135);
analogWrite(ledPin2, random(120)+135);
analogWrite(ledPin3, random(120)+135);
delay(random(100));
}

To keep the light in the Red/Orange/Yellow range you probably want to make sure that the Green and Blue components are the same intensity:

int ledPinRed = 10;
int ledPinGreen = 9;
int ledPinBlue = 11;

void setup()
{
pinMode(ledPinRed, OUTPUT);
pinMode(ledPinGreen, OUTPUT);
pinMode(ledPinBlue, OUTPUT);
}

void loop() {
int Red = random(120)+135;
int Yellow = random(120)+135;
analogWrite(ledPinRed, Red);
analogWrite(ledPinGreen, Yellow);
analogWrite(ledPinBlue, Yellow);
delay(random(100));
}

johnwasser:
To keep the light in the Red/Orange/Yellow range you probably want to make sure that the Green and Blue components are the same intensity:

Unfortunately, green and blue do not mix to give yellow, that gives cyan. You need to mix red and green to get yellow. Try selecting a random red level, then a random green level that is no greater than the red level you picked. Either don't use blue at all, or use a random blue level that is no greater than the green level you picked.

I would not flash the blue one at all and limit the range of the green LED to keep all he colours flame like.

Ah thanks so much guys! The code johnwasser gave worked a treat! It now flickers red/yellow :slight_smile: