controlling led based on distance of object

Hello, I'm using a range finder and would like to control different light colours at a set distance. but when i try to mix the colours ie to get an orange .. it still come up as red. can some help.

/*

*/
#include <Wire.h>
#include <LIDARLite.h>

LIDARLite myLidarLite;

int greenPin = 12;
int bluePin = 11;
int redPin = 13;
int Brightness = 255;


void setup() {
  Serial.begin(115200); // Initialize serial connection to display distance readings

  myLidarLite.begin(0, true); // Set configuration to default and I2C to 400 kHz
  
  myLidarLite.configure(0); // Change this number to try out alternate configurations
  
  // rgb
  pinMode(greenPin, OUTPUT);
	pinMode(bluePin, OUTPUT);
	pinMode(redPin, OUTPUT);

}
void loop() {

  if (myLidarLite.distance() < 80 && myLidarLite.distance() > 45)
  {
  Serial.println("GREEN LIGHT");
  analogWrite(redPin, 0);
  analogWrite(bluePin, 0);
  analogWrite(greenPin, 255);
  }
  else if (myLidarLite.distance() < 40 && myLidarLite.distance() >25)
  {
  Serial.println(" ORANGE LIGHT ");
  analogWrite(redPin, 200);
  analogWrite(bluePin, 0);
  analogWrite(greenPin, 20);
  }
    else if (myLidarLite.distance() < 20)
  {
  Serial.println(" RED LIGHT ");
  analogWrite(redPin, 255);
  analogWrite(bluePin, 0);
  analogWrite(greenPin, 0);
  }
  else
  {
  analogWrite(redPin, 0);
  analogWrite(bluePin, 0);
  analogWrite(greenPin, 0);

  }
}

Make sure that you are connecting to PWM pins, otherwise analogWrite() behaves like digitalWrite().

Ic. Thanks. Just looked at the pin out for arduino uno.
Also is there a way of define "def" a variable and calling it later like in Python.

No idea how Python works. In C++ There is #define and the "const int greenPin = 12;" type of declaration, but you don't 'call' variables, you call functions.

#define is used by the C++ preprocessor for textual substitution. const definition allows for type checking and does not allocate space for a simple variable, substituting for the value instead.

You can also define your own functions that you can 'call' later, with parameters. This is exactly what setup() and loop() are (with no parameters).

As stated, you need to be using PWM capable pins in order for analogWrite to do anything analog-y.
3, 5, 6, 9, 10, 11 on most Arduinos. The board may even have little squigly lines ~ next to the pins to help you out even more.