Controlling Fan with LM35

Hello, I want to create a 5V fan that will be controlled by temperature using LM35. I have the code that i got it from internet and i had changed some. When I upload the code, the fan spin in constant not increase and decrease. The code is shown below :

int tempPin = A2;   // the output pin of LM35
int fan = 11;       // the pin where fan is
int temp;
int tempMin = 0;   // the temperature to start the fan
int tempMax = 60;   // the maximum temperature when fan is at 100%
int fanSpeed;
int fanLCD;
void setup() {
  pinMode(fan, OUTPUT);
  pinMode(tempPin, INPUT);
void loop() {  
   temp = readTemp();     // get the temperature
   if(temp < tempMin) {   // if temp is lower than minimum temp
       fanSpeed = 0;      // fan is not spinning
       digitalWrite(fan, LOW);       
   if((temp >= tempMin) && (temp <= tempMax)) {  // if temperature is higher than minimum temp
       fanSpeed = map(temp, tempMin, tempMax, 0, 255); // the actual speed of fan
       fanLCD = map(temp, tempMin, tempMax, 0, 100);  // speed of fan to display on LCD
       analogWrite(fan, fanSpeed);  // spin the fan at the fanSpeed speed
   Serial.print("TEMP: ");
   Serial.print(temp);      // display the temperature
   Serial.print("C ");
   Serial.print("FANS: ");
   Serial.print(fanLCD);    // display the fan speed
int readTemp() {  // get the temperature and convert it to celsius
  temp = analogRead(tempPin);
  return temp * 0.48828125;

Please help me.

how much you are changing the temperature?
i mean to say how much you are varying the the temp to measure the fan speed?

If temp more than 60 degree celcius. the fan spin fast. If below, it spin low

If temp more than 60 degree celcius. the fan spin fast. If below, it spin low

did you checked at 60 degree celcius??