LM35 + RGB

Hi, i am trying to write a code for LM35 + RGB to change color of RGB LED at different temperature but this is not working, please see code is there is any issue with code? I am using attiny85 usb and connected LM35 in A2 (D2 pin)

int ledb = 0;
int ledg = 1;
int ledr = 2;
int lm= A2;   // por algún motivo solo funciona analógico en el pin 3
 
void setup()
{               
    pinMode(ledb, OUTPUT);  
    pinMode(ledg, OUTPUT); 
    pinMode(ledr, OUTPUT); 
    
}
  void loop()
{
   int temp;
   temp=abs(410.0*analogRead(lm)/1023.0);

   if (temp<=30)                                               //if the temperature is low
{
  digitalWrite(ledb, HIGH);
  digitalWrite(ledg, LOW);
  digitalWrite(ledr, LOW);
}
else if (temp>=31 && temp<=40)                // if the temperature is middle            
 {
  digitalWrite(ledb, LOW);
  digitalWrite(ledg, HIGH);
  digitalWrite(ledr, LOW);
}
else if (temp>=41)                                  //If the temperature is HIGH
{
  digitalWrite(ledb, LOW);
  digitalWrite(ledg, LOW);
  digitalWrite(ledr, HIGH);
}
delay(100);
 }

Please provide a detailed description of what you mean by "this is not working".

it is not changing the color of LED after increasing the temperature at LM35 temperature sensor.

I don't have the right sensor, so I just used a potentiometer and changed the values in the if's so it was looking under 200, 200-400, over 400.

Works for me....

You should Serial.print() the values of the analogRead() temp.

abhixs:
it is not changing the color of LED after increasing the temperature at LM35 temperature sensor.

Check your LM35. If you bought it directly from China you have a good chance that it's a counterfeit (remarked transistor)