Getting stuck in a loop even when the conditions for the statement changes

I am witting a program that takes input from a photo resistor and turn on either a green LED or a RED led. I have a range set up between 130 and 150 that should turn on the green LED and if the level is outside of that range, a red LED is supposed to turn on.

Here is my code:

//#include <wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

const int photoSens = 0;
const int redLed = 2;
const int greenLed = 3;
const int blueLed = 4;
int lightOkay();
int lightBad();

void setup() {
  Serial.begin(9600);
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
  pinMode(blueLed, OUTPUT);
  pinMode(photoSens, INPUT);

  lcd.begin(16,2);

   for(int i = 0; i< 3; i++)
  {
    lcd.backlight();
    delay(250);
    lcd.noBacklight();
    delay(250);
  }
  lcd.backlight();

}

void loop() {



    int lightLevel;
    lightLevel = analogRead(photoSens);
    lightLevel = map(lightLevel, 0, 1023, 1, 255);
    lightLevel = constrain(lightLevel, 1 , 255);
    
    Serial.print("LightLevel");
    Serial.println(lightLevel);
    delay (300);
    if((lightLevel >130) && (lightLevel < 150))
      {
        lightOkay();
      
      }
    else if((lightLevel < 129) || (lightLevel > 151))
      {
        
        lightBad();
      }




}

int lightOkay()
{
  Serial.println ("GreenON");
  delay (500);
  digitalWrite(greenLed, HIGH);
} 

int lightBad()
{
  Serial.println("RedON");
  delay(500);
  digitalWrite(greenLed, LOW);
  digitalWrite(redLed, HIGH);
}

If you look at the light level in Serial Mon 1 you can see that the light level falls into the range where the green LED is on and GREENON, but REDON is being printed to the screen.

I have no clue as to why this is happening. My instructor thinks there is something wrong with the logic, but I am not so sure.

any help would be greatly appreciated.

Serial Mon 1.png

drunyan0824:
If you look at the light level in Serial Mon 1 you can see that the light level falls into the range where the green LED is on and GREENON, but REDON is being printed to the screen.

The value in your image is consistently 33. Is 33 inside or outside your range?

How does your code behave when lightLevel is precisely 130?

How does your code behave when lightLevel is precisely 150?

33 is outside of the range so the Red Led should be on. I am attaching a second image where the value from the sensor should be in range to turn on the green LED. The level from the sensor is 145 so the green LED should be on and the serial monitor should print GREENON. But the program didn't go to that part of the if statement.

You don't need the second if(). When the first one is not true, then just do the lightBad();

MorganS:
You don't need the second if(). When the first one is not true, then just do the lightBad();

I need to add some more ranges and I was just starting of with the good range and the bad range first. At this point I feel rather foolish because my program is working correctly, I was reading the serial monitor wrong.