Trying to red RGB LED from Red to Blue then Back.

(If I make a formatting mistake, or this is in the wrong place, I'm sorry, new here.)

Essentially, Im trying to make this LED fade from Red (redValue = 100; blueValue = 0;) to Blue, and back.

Im doing so using this Code. It should slowly increment blueValue and Decrement redValue until redValue is 0, and it will reverse. (This is upload redIncrease flipping)

const int greenLEDPin = 9;
const int redLEDPin = 11;
const int blueLEDPin = 10;

int redValue = 100;
int greenValue = 0;
int blueValue = 0;

int redIncrease = true; 

void setup(){
  Serial.begin(9600);
  pinMode(greenLEDPin, OUTPUT);
  pinMode(blueLEDPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
}

void loop(){
  if(redValue = 100){
    redIncrease = true;
  }
  
  else if(redValue = 0){
    redIncrease = false;
  }

  if(redIncrease == false){
    redValue = redValue + 1;
    blueValue = blueValue - 1;
    Serial.print("Redmax is False");
    Serial.print("\t");
    Serial.print(redValue);
    Serial.print("\t");
    Serial.print(blueValue);
    delay(500);
  }
  
  else if(redIncrease == true){
    redValue = redValue - 1;
    blueValue = blueValue + 1;
    Serial.print("Redmax is TRUE");
    Serial.print("\t");
    Serial.print(redValue);
    Serial.print("\t");
    Serial.print(blueValue);
    delay(500);
  }  
  
  
  
analogWrite(redLEDPin, redValue);
analogWrite(greenLEDPin, greenValue);
analogWrite(blueLEDPin, blueValue);

}

However, what is happening is, blue is incrementing, but red is stuck at 99 (it decrements once, but wont loop, unlike blue)

I'm using an Arduino Uno.

I'm assuming i've made a code mistake. This is my first go a writing my own code.

Any help would be amazing. Thank you.

Your main bug is here:

  if(redValue = 100){
    redIncrease = true;
  }
  
  else if(redValue = 0){
    redIncrease = false;
  }

Convert the if conditions to use "==" instead of "=".

Bug aside, I would probably do something like this instead:

#define MAX_VALUE 100

const byte greenLEDPin = 9;
const byte redLEDPin = 11;
const byte blueLEDPin = 10;

int redValue = MAX_VALUE;
int greenValue = 0;
int blueValue = 0;

int increment = 0;

void setup()
{
  pinMode(greenLEDPin, OUTPUT);
  pinMode(blueLEDPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
}

void loop()
{
    if (redValue == MAX_VALUE)
        increment = -1;

    if(redValue == 0)
        increment = 1;

    redValue += increment;
    blueValue = MAX_VALUE - redValue;

    analogWrite(redLEDPin, redValue);
    analogWrite(greenLEDPin, greenValue);
    analogWrite(blueLEDPin, blueValue);

    delay(500);
}

That worked, if you've chance, could you quickly explain what you did differently? (I'm trying to understand the coding stuff, not just get the LED working ahha)

Thank you