LCD lights up depending on sensor value.

Hi,
So I have created an Air Pollution sensor that displays the air pollution on a 20x4 LCD screen. Now I want to take it to the next level, what I want to know is possible is if I can have 4-5 led lights that light up individually depending on the air pollution value. For example I can have the lights lined up like this
RED
YELLOW
GREEN
WHITE.
and if the sensor value is over 50 (which is considered bad), I want the red led to light up. If the sensor value is 2 (which is excellent) then the white led would light up. Is this possible? and if so where would I start as I am completely clueless on what to do. Thank you so much for taking the time to read this!
Kind Regards,
Ahmed

#include "PMS.h"
#include "SoftwareSerial.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

SoftwareSerial Serial1(2, 3); // RX, TX

PMS pms(Serial1);
PMS::DATA data;

void setup()
{
  Serial1.begin(9600);
  lcd.begin(20,4);
  lcd.setCursor(0, 0);
  lcd.print("Warming up");
  delay(4000);
  lcd.clear();
}

void loop()
{
  if (pms.read(data))
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Particle Pollution");
    lcd.setCursor(0, 1);
    lcd.print("PM2.5 :" + String(data.PM_AE_UG_2_5) + "(ug/m3)");
    lcd.setCursor(0, 2);
    lcd.print("PM10  :" + String(data.PM_AE_UG_10_0) + "(ug/m3)");
    lcd.setCursor(0, 3);
    if (data.PM_AE_UG_10_0<15)
      lcd.print("Excellent Quality");
    else if (data.PM_AE_UG_10_0<20)
      lcd.print("Very Good Quality");
    else if (data.PM_AE_UG_10_0<25)
      lcd.print("Good Quality");
    else if (data.PM_AE_UG_10_0<30)
      lcd.print("Decent Quality");
    else if (data.PM_AE_UG_10_0<35)
      lcd.print("Ok Quality");
    else if (data.PM_AE_UG_10_0<40)
      lcd.print("Ok Quality");
    else if (data.PM_AE_UG_10_0<45)
      lcd.print("Not Good Quality");
    else if (data.PM_AE_UG_10_0<50)
      lcd.print("Bad Quality");
    else if (data.PM_AE_UG_10_0<55)
      lcd.print("Very Bad Quality");
    else if (data.PM_AE_UG_10_0<100)
      lcd.print("Horrible Quality");
    delay(1000);
  }
}

Why not use a WS2812 programmable LED with the NeoPixel library from Adafruit? One LED, one pin, any colour you want!

Whichever way you do it, the instructions to switch the corresponding LED will be associated with each of your “lcd.print” lines which will each have to be expanded into a braced statement

else if (data.PM_AE_UG_10_0<40) {
      lcd.print("OK Quality");
      digitalWrite(OK_LED, 1);
     }

Note that “OK” is conventionally all capitals. :grinning:

If you use individual LEDs, then you will have to arrange to turn the others off also.

Note that “lcd.clear();” should not be in the loop as it will cause really annoying flicker. You should determine when you actually need to write a line different and only then then set the cursor to match and use a write command which writes over all of the previous data, whatever that was (and not necessarily the whole 20 characters).