if condition not swapping as string variable changes

I'm playing with a RGB led attempting to change colors as temperature changes. The problem I'm having is if the String variable "TempColor" changes from Green to Yellow. The if statement stays on Yellow. It does not swap to "if else" Yellow.

Serial.print(F("Temp Color Code: ")); Serial.println(TempColor);

    if(TempColor = "Green")
      {
      setColor(0, 255, 0);
      }
      else if(TempColor = "Yellow")
      {
      setColor(255, 255, 0);
      }
      else if(TempColor = "Orange")
      {
      setColor(255, 125, 0);
      }
      else if(TempColor = "Red")
      {
      setColor(255, 0, 0);
      }
      else if(TempColor = "Purple")
      {
      setColor(125, 0, 255);
      }
      else
      {
      setColor(255, 0, 125);
      }

= for assignment, == for comparison. The if is a comparison.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.